组合框绑定显示列表但将选择绑定到实体?
我正在使用 Silverlight 4 导航模板。我使用 DomainDataSource 加载名为 Issue 的特定实体。每个问题都有一个类别。但我不确定执行组合框绑定的最佳方法,以便组合框填充类别,但所选项目绑定到正在编辑的问题的类别。我有一个看起来完全是黑客的方法。所以想请教专家一些建议。
I am using a Silverlight 4 Navigation template. I use a DomainDataSource to load a specific entity called Issue. Each Issue has a Category. But I am not sure of the best way to perform the binding of a combobox so that the combobox is populated with the categories but the selected item is bound to the category of the Issue being edited. I have a method that seems like a total hack. So I would like some adice from the experts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ComboBox 有两个可以绑定的不同属性,它有一个 ItemsSource 和一个 SelectedValue。
因此,在这种情况下,您可以将类别列表绑定到 ItemsSource,并将问题的类别绑定到 SelectedValue。
请查看此处了解更多信息:
http://johnpapa.net/ silverlight/绑定到silverlight-combobox-and-using-selectedvalue-selectedvaluepath-and-displaymemberpath/
ComboBox has two different properties you can bind to, it has a ItemsSource, and a SelectedValue.
So in this case you could bind your list of categories tot he ItemsSource, and bind your category on your issue to SelectedValue.
Take a look here for more information:
http://johnpapa.net/silverlight/binding-to-silverlight-combobox-and-using-selectedvalue-selectedvaluepath-and-displaymemberpath/