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 t开发者_开发百科o 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; }
}
}
I have also tried this workaround and i had problems.
In xaml i have no problems to set and define some properties of a RibbonTextBox. I can run the code an the textbox is displayed on the screen but not enabled.
if i include the workaround-code inside my MainWindow.xaml.cs i get an error "The type or namespace name 'RibbonTextBox' could not be found'.
Where i have to include the code ( MainWindow.xaml.cs ? ).
The namespace system.windows.controls.ribbon is unknown. Which dll must be set into references ( cant find System.Windows.Controls.Ribbon in references)? I think i have to use this namespace to get ribbontextbox. I use VS2010 express c#.
精彩评论