列表框选择事件未被触发
我从 WPF ListBox
收到奇怪的行为。
我的 ListBox
显示了可观察的属性集合,每个属性都有一个名为factoryFriendlyname 的字符串属性。工厂友好名称的价值始终是独一无二的。当我单击列表框中的某个项目时,会触发选择更改事件,并选择相关项目。
问题是,同时它还会选择两个或三个没有明显联系的其他项目,然后不会为任何进一步的选择更改选择。
如果我确实进行了进一步的选择,这些项目将突出显示,就像它们正在被选择一样,但是更改的选定项目不会再次触发。不是选择新节点,而是将进一步的选择添加到现有节点上,因此每次单击时,另一个项目都会变成蓝色。
我真的可以理解 ListBox
发生了什么。
Xaml:
<ListBox ItemsSource="{Binding ToolBoxItems}"
Name="nodelist" Grid.Column="0"
Grid.Row="1" SelectionMode="Single"
SelectionChanged="DoSelectionChanged"
DisplayMemberPath="FactoryFriendlyName"/>
DoSeletionChanged
只是加载所选项目。任何帮助将不胜感激。
I'm getting strange behaviour from WPF ListBox
.
My ListBox
is displaying an observable collection of Attributes, each attribute has a string property called factoryfriendlyname. The value of factory friendly name is always unique. When I click on an item in the list box, the selection changed event is fired, and the item in question is selected.
The problem is at the same time it will also select two or three other items with no apparent connection, and will then not fire selection changed for any further selections.
If I do make further selections, the items are highlighted as if they are being selected, but selected items changed is not fired again. Rather than selecting a new node, further selections are added onto existing ones, so every time I click, another item turns blue.
I really can understand what is going on with the ListBox
.
Xaml:
<ListBox ItemsSource="{Binding ToolBoxItems}"
Name="nodelist" Grid.Column="0"
Grid.Row="1" SelectionMode="Single"
SelectionChanged="DoSelectionChanged"
DisplayMemberPath="FactoryFriendlyName"/>
DoSeletionChanged
simply loads the selected item. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论