无法设置RibbonTextBox isEnable为False [英] Cannot set RibbonTextBox isEnable to False

查看:347
本文介绍了无法设置RibbonTextBox isEnable为False的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试了功能区控件,并经历了一个可能的错误(或我做错了什么也许)。如果我有一个 RibbonTextBox RibbonTab ,并设置在 isEnabled 在后面的代码,我只能将它设置为false,但不是真正的。在 RibbonTextBox 依然被禁用。

  / *在我的XAML * / 
<丝带:RibbonTextBox X:NAME =实时出价标签=Button1的/>

/ *后面* / $ B $我的代码为B rtb.IsEnabled = FALSE; // RibbonTextBox被禁用并呈灰色
...一些其他的代码...
rtb.IsEnabled = TRUE; // RibbonTextBox保持禁用并呈灰色


解决方案

Apperently,这是一个已知的问题。



RibbonTextBox IsEnabled属性始终为false



一个可能的解决方法也是在该链接结果
给出的更新:我想这个解决方法我和它确实工作

 公共类FixedRibbonTextBox:RibbonTextBox 
{
保护覆盖布尔IsEnabledCore
{
获得{返回true; }
}
}


I have been trying out the Ribbon Controls and experienced a possible bug (or I am doing something wrong perhaps). If I have a RibbonTextBox on the RibbonTab, and setting the isEnabled to False or True in code behind, I can only set it to false but not the true. The RibbonTextBox remain to be disabled.

/* in my XAML */
<ribbon:RibbonTextBox x:Name="rtb" Label="Button1" />

/* in my code behind */
rtb.IsEnabled = false;  // RibbonTextBox is disabled and grayed out
... some other code ...
rtb.IsEnabled = true;   // RibbonTextBox remain disabled and grayed out

解决方案

Apperently, this is a known issue

RibbonTextBox IsEnabled property is always false

A possible workaround is also given at that link
Update: I tried this workaround myself and it does indeed work

public class FixedRibbonTextBox : RibbonTextBox
{
    protected override bool IsEnabledCore
    {
        get { return true; }
    }
}

这篇关于无法设置RibbonTextBox isEnable为False的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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