这应该相对简单,但我没有运气好运。 我是设计师,Blend的新手,创建Silverlight SketchFlow应用程序。
我正在尝试将AutoCompleteBox绑定到名为 PaymentType $ b $的数据源b ,它包含一个名为 PayTypeCollection 的集合和一个简单属性 PayType (字符串)。
如果我只是绑定对于控件, PayTypeCollection ,列表框打开,但包含"Expression.Blend.SampleData.PaymentType.PayTypeCollectionItem""重复多次。
这是XAML:
< sdk:AutoCompleteBox
Height =" 24"保证金=" 232,0,412,144"
VerticalAlignment =" Bottom"
FilterMode ="包含"
DataContext =" {Binding Source = {StaticResource PaymentType}}"
ItemsSource =" {Binding PayTypeCollection}">
< / sdk:AutoCompleteBox>
然后我尝试将 ValueMemberBinding 属性设置为 PayType 列,我可以在文本框中输入,但列表不会打开。解决方案
您好,
这是一个可能的解决方案,假设您的项目中有以下类(SL4):
Public Class PaymentType Sub New () 使用 我 .PaymentTypeCollection .Add(" Cash" ) .Add(" Visa" ) .Add(" MasterCard" ) 结束 使用 End Sub Public Property PaymentTypeCollection As New 收藏 结束 Class
This should be relatively easy but I'm not having any luck getting it to work. I'm a designer, new to Blend, creating a Silverlight SketchFlow Application.
I'm trying to bind the AutoCompleteBox to a Data Source namedPaymentType and it contains a collection called PayTypeCollection and one simple property PayType (string).
If I simply bind the PayTypeCollectionto the control, the list box opens, but contains "Expression.Blend.SampleData.PaymentType.PayTypeCollectionItem" repeated multiple times.
Here's the XAML:
<sdk:AutoCompleteBox
Height="24" Margin="232,0,412,144"
VerticalAlignment="Bottom"
FilterMode="Contains"
DataContext="{Binding Source={StaticResource PaymentType}}"
ItemsSource="{Binding PayTypeCollection}">
</sdk:AutoCompleteBox>
I then tried to set the ValueMemberBinding property to the PayType column and I can type in the text box but the list doesn't open. 解决方案Hello,
here is one possible solution, given you have the following class in your project (SL4):
Public Class PaymentType Sub New() With Me.PaymentTypeCollection .Add("Cash") .Add("Visa") .Add("MasterCard") End With End Sub Public Property PaymentTypeCollection As New Collection End Class更多推荐
如何在Silverlight4 Toolkit中数据绑定到AutoCompleteBox?
发布评论