WPF中TabControl的TabChanged事件(TabChanged event of TabControl in WPF)
我在WPF中有一个TabControl。 我想查找更改标签页时发生的事件。 这个活动的名字是什么?
I have a TabControl in WPF. I want to find an event that occurs when changing tabs. What is the name of this event?
最满意答案
TabControl继承自包含SelectionChanged事件的Selector 。
<TabControl SelectionChanged="OnSelectionChanged" ... /> private void OnSelectionChanged(Object sender, SelectionChangedEventArgs args) { var tc = sender as TabControl; //The sender is a type of TabControl... if (tc != null) { var item = tc.SelectedItem; //Do Stuff ... } }The TabControl inherits from a Selector which contains the SelectionChanged event.
<TabControl SelectionChanged="OnSelectionChanged" ... /> private void OnSelectionChanged(Object sender, SelectionChangedEventArgs args) { var tc = sender as TabControl; //The sender is a type of TabControl... if (tc != null) { var item = tc.SelectedItem; //Do Stuff ... } }更多推荐
发布评论