我一直在尝试功能区控件并遇到了一个可能的错误(或者我可能做错了什么)。如果我在 RibbonTab
上有一个 RibbonTextBox
,并将 isEnabled 设置为 False 或 True 在后面的代码中,我只能将其设置为 false 而不能设置为 true。 RibbonTextBox
仍处于禁用状态。
/* 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
最佳答案
显然,这是一个已知问题
RibbonTextBox IsEnabled property is always false
该链接还提供了一个可能的解决方法
更新:我自己尝试了这个解决方法,它确实有效
public class FixedRibbonTextBox : RibbonTextBox
{
protected override bool IsEnabledCore
{
get { return true; }
}
}
关于c# - 无法将 RibbonTextBox isEnable 设置为 False,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6883475/