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

查看:33
本文介绍了标准 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天全站免登陆