无法将RibbonTextBox isEnable设置为False

KMC*_*KMC 3 c# wpf ribbon-control isenabled

我一直在尝试使用Ribbon控件并遇到可能的错误(或者我可能做错了).如果我有一个RibbonTextBoxon RibbonTab,并在后面的代码中将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
Run Code Online (Sandbox Code Playgroud)

Fre*_*lad 5

显然,这是一个已知问题

RibbonTextBox IsEnabled属性始终为false

在该链接上也给出了一个可能的解决方法
更新:我自己尝试了这种解决方法,它确实有效

public class FixedRibbonTextBox : RibbonTextBox
{
    protected override bool IsEnabledCore
    {
        get { return true; }
    }
}
Run Code Online (Sandbox Code Playgroud)