Viewmodel中的Combobox selectionchange事件 [英] Combobox selectionchange event in Viewmodel

查看:96
本文介绍了Viewmodel中的Combobox selectionchange事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是WPF的新手。我想在Viewmodel类中实现ComboBox的selectionChange事件,其中组合框在Xaml中。



我不需要选择更改事件在xaml.cs



请建议更好的方法。



谢谢,

Prasant

解决方案

Prasant,为此您必须使用 ICommand viewmodel 中的属性。并将此属性绑定到XAML中的 SelectionChanged 事件。

请参阅此链接 -



http:// nerobrain.blogspot.in/2012/01/execute-command-on-combobox-selection.html [ ^ ]



*您还可以使用交互式触发器 - < br $>


http://www.mindfiresolutions.com/Using-Interaction-Triggers-to-bind-Events-to-View-Modals-2196.php [ ^ ]

Hi,

I am new to WPF.I wanted to implement selectionChange event of ComboBox in Viewmodel class where combobox is there in Xaml.

I don't need in selection Change event in xaml.cs

Please suggest the better approach.

Thanks,
Prasant

解决方案

Prasant, for this you have to use ICommand Property inside your viewmodel. And bind this property to your SelectionChanged event in XAML.
Please refer this links -

http://nerobrain.blogspot.in/2012/01/execute-command-on-combobox-selection.html[^]

* You can also use Interaction triggers -

http://www.mindfiresolutions.com/Using-Interaction-Triggers-to-bind-Events-to-View-Modals-2196.php[^]


这篇关于Viewmodel中的Combobox selectionchange事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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