在标准WPF选项卡控件中是否有“选项卡更改事件” [英] Is there Selected Tab Changed Event in the standard WPF Tab Control

查看:191
本文介绍了在标准WPF选项卡控件中是否有“选项卡更改事件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF中,是否有一个事件可以用于确定何时更改 TabControl 的选择标签?

In WPF, is there an event that can be used to determine when a TabControl's selected tab changes?

我尝试使用 TabControl.SelectionChanged ,但是当选项卡中的孩子选择更改时,它会被多次触发。

I have tried using TabControl.SelectionChanged but it is getting fired many times when a child's selection within a tab is changed.

推荐答案

我把它绑在处理程序中,使其工作:

I tied this in the handler to make it work:

void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (e.Source is TabControl)
    {
      //do work when tab is changed
    }
}

这篇关于在标准WPF选项卡控件中是否有“选项卡更改事件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆