开发者

WPF Toolkit Datagrid - Can I call a function in view-model, on selection of a row?

开发者 https://www.devze.com 2023-01-01 01:15 出处:网络
I have a WPf Toolkit-datagrid..in my application which开发者_运维知识库 follows MVVM pattern.

I have a WPf Toolkit-datagrid..in my application which开发者_运维知识库 follows MVVM pattern. How I can call a function in view-model if user selects a particular row in datagrid ?


in view

  <DataGrid ItemSource="{Binding MyItems}"
            SelectedItem = "{Binding MyCurrentItem}"
             >

in vm

private Myobject myCurrentItem;
public Myobject MyCurrentItem
                   {
                      get{ return myCurrentItem; }
                      set{
                            if (myCurrentItem!=value)
                            {
                               myCurrentItem=value;
                               DoMyStuff();
                            }                              
                         }
                    }
0

精彩评论

暂无评论...
验证码 换一张
取 消