c# - 无法将 RibbonTextBox isEnable 设置为 False

标签 c# wpf ribbon-control isenabled

我一直在尝试功能区控件并遇到了一个可能的错误(或者我可能做错了什么)。如果我在 RibbonTab 上有一个 RibbonTextBox,并将 isEnabled 设置为 FalseTrue 在后面的代码中,我只能将其设置为 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/

相关文章:

c# - 这是 n 层架构的正确实现吗?

wpf - 嵌套的 WPF 数据网格

wpf - 将单元格对象的属性绑定(bind)到 WPF DataGrid 中的 DataGridCell

c# - 最小连续序列组

C# Socket.Receive 消息长度

wpf - 如果不指定祖先,绑定(bind)将不起作用

wpf - 将Office 2007主题应用于WPF应用程序

c# - 我可以向功能区添加自定义控件吗?

vba - 使用 VBA 将自定义组添加到 Outlook 2010 中的“主页”选项卡

c# - Linq 类似或其他结构