In C# WPF, why is my TabControl's SelectionChanged event firing too often?

前端 未结 4 1508
小鲜肉
小鲜肉 2020-11-30 02:41

I have a tabbed GUI with each tab containing a Frame. In one of these Frames there is a DataGrid. When the user selects this tab, I need my datagrid sorted, so I\'m using th

4条回答
  •  广开言路
    2020-11-30 03:25

    If you have added a handler with AddHandler in a parent element, all selection changes will fire the SelectionChanged-event. In this case, you can give your TabControl a name and then check in the EventHandler if the name of the OriginalSource is the name of your TabControl.

提交回复
热议问题