Search code examples
c#wpfribbon-controlisenabled

Cannot set RibbonTextBox isEnable to False


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

Solution

  • 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; }
        }
    }