问题描述
我一直在尝试了功能区控件,并经历了一个可能的错误(或我做错了什么也许)。如果我有一个 RibbonTextBox
在 RibbonTab
,并设置在 isEnabled 为假或真在后面的代码,我只能将它设置为false,但不是真正的。在 RibbonTextBox
依然被禁用。
/ *在我的XAML * /
<丝带:RibbonTextBox X:NAME =实时出价标签=Button1的/>
/ *后面* / $ B $我的代码为B rtb.IsEnabled = FALSE; // RibbonTextBox被禁用并呈灰色
...一些其他的代码...
rtb.IsEnabled = TRUE; // RibbonTextBox保持禁用并呈灰色
Apperently,这是一个已知的问题。
的
一个可能的解决方法也是在该链接结果
给出的更新:我想这个解决方法我和它确实工作的
公共类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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!