如何在Silverlight4 Toolkit中数据绑定到AutoCompleteBox?

编程入门 行业动态 更新时间:2024-10-23 04:37:28
本文介绍了如何在Silverlight4 Toolkit中数据绑定到AutoCompleteBox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这应该相对简单,但我没有运气好运。 我是设计师,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?

本文发布于:2023-11-25 02:13:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627902.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   数据   如何在   Toolkit   AutoCompleteBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!