试图找出如何取消TabControl.SelectionChanged在Silverlight [英] Trying find how to cancel TabControl.SelectionChanged in silverlight

查看:146
本文介绍了试图找出如何取消TabControl.SelectionChanged在Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何在Silverlight取消本次活动,遗憾的是我没有找到解决任何有用的链接:((我看到一些职位WPF至极,我认为不能再使用Silverlight的)

I am trying figure out how cancel this event in silverlight, sadly i didn't find any useful link with the solution :( (i saw some post for wpf wich i think are not longer available for silverlight)

推荐答案

下面是它的基本框架: -

Here is the bare bones of it:-

    bool cancellingTabSelectionChange = false;
    private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (e.RemovedItems.Count > 0 && !cancellingTabSelectionChange)
        {
            cancellingTabSelectionChange = true;
            ((TabControl)sender).SelectedItem = e.RemovedItems[0];
            cancellingTabSelectionChange = false;
        }
    }

您将需要添加额外的标准,将允许改变发生的,因为上面的code总是阻止标签的变化。

You would need to add the extra criteria the would allow a change to take place since the above code would always block a change of tab.

这篇关于试图找出如何取消TabControl.SelectionChanged在Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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