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

前端 未结 4 1504
小鲜肉
小鲜肉 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:37

         private void tabControlName_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                if (e.Source is TabControl) //if this event fired from TabControl then enter
                {
                    if (tabItemName.IsSelected)
                    {
                        //Do your job here
                    }
                }
            }
    

提交回复
热议问题