could the SelectionChanged event in WPF be handled only for user interaction?

前端 未结 3 833
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 20:58

I would like to handled SelectionChanged event in WPF DataGrid element for user interaction/selection only and skip if it\'s due to binding or other set values. Any idea how

3条回答
  •  借酒劲吻你
    2020-12-16 21:54

    hi you can use this in xaml:

     
                                            
                                                
                                            
                                        
    

    and in code behind:

    private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!((ComboBox)sender).IsEditable) return;
            //Do Stuff;
        }
    

提交回复
热议问题