[UWP] SfComboBox DisplayMemberPath问题 [英] [UWP]Problem with SfComboBox DisplayMemberPath

查看:78
本文介绍了[UWP] SfComboBox DisplayMemberPath问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我附上了样本以揭露问题。

I have attached sample to expose the issue.

在此示例中,我已将该集合绑定到SfComboBox并且在按钮单击事件中动态地将项添加到集合中。项目添加并正确显示,直到第一次打开下拉列表。添加该项后,但DropDown中的项目未显示

In this sample i have binded the collection to SfComboBox and added the item to the collection dynamically in button click event. Items added and shown properly until the dropdown is opened for the first time. After that item added but item not displayed in DropDown.

复制步骤:

1。运行示例

2。点击添加按钮。

3。现在打开DropDown。参见第1项。

3. Now open DropDown. See Item1 is added.

4。再次单击"添加"按钮,再次打开DropDown。项目已添加但无法在DropDown中查看。

4. Again click the add button and again open the DropDown. Item added but not able to see in DropDown.

示例:https://www.dropbox.com/s/qjkt94canfpi39p/UWPSample.zip?dl = 0 

Sample: https://www.dropbox.com/s/qjkt94canfpi39p/UWPSample.zip?dl=0 

问候,

Priyanga B

Priyanga B




推荐答案

Hello
PriyangaB

欢迎来到开发通用Windows应用程序
论坛!

请阅读粘贴帖子,特别是  发布指南:主题行
标签
   Windows 10 SDK和工具的已知问题 ,
并且不要忘记在您的问题中添加标记。

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools , and don't forget add tag to your question.

假设您有一些List< T>什么将它设置为任何ItemsControl的ItemSource(ListView,GridView,ListBox,ComboBox等等) 

Let imagine that you have some List<T> and what set it as ItemSource for any ItemsControl (ListView,GridView,ListBox,ComboBox, etc.....) 

 ItemsControl.ItemsSource= List<T>;


每次向< T>列表< T>添加项目时调用的代码您应该通知View我添加到您的源新项目显示它。的&NBSP;列表与LT; T>不提供此类功能,而是使用  ObservableCollection< T >
然后全部按预期工作。

code invoked, every time when you add Items to the List<T> you should notify View that I added to your source new item display it. The List<T> doesn't provide such functionality instead it use  ObservableCollection<T> and then all works as you expected.

private ObservableCollection<State> states; public MainPage() { this.InitializeComponent(); States = new ObservableCollection<State>(); ............. } public ObservableCollection<State> States { get { return states; } set { states = value; } }

........


如需更多阅读
THIS


For more read THIS


这篇关于[UWP] SfComboBox DisplayMemberPath问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆