无法将 RibbonTextBox isEnable 设置为 False
我一直在尝试功能区控件并遇到可能的错误(或者我可能做错了什么)。如果我在 RibbonTab
上有一个 RibbonTextBox
,并将 isEnabled 设置为 False 或 TrueRibbonTextBox 仍处于禁用状态。
/* 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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显然,这是一个已知问题
RibbonTextBox IsEnabled 属性始终为 false< /a>
该链接还给出了可能的解决方法
更新:我自己尝试了这个解决方法,它确实有效
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
我也尝试过这个解决方法,但遇到了问题。
在 xaml 中,我可以毫无问题地设置和定义 RibbonTextBox 的某些属性。我可以运行代码,文本框显示在屏幕上但未启用。
如果我在 MainWindow.xaml.cs 中包含解决方法代码,则会收到错误“找不到类型或命名空间名称“RibbonTextBox””。
我必须在哪里包含代码( MainWindow.xaml.cs ? )。
命名空间 system.windows.controls.ribbon 必须是未知的。设置为引用(在引用中找不到 System.Windows.Controls.Ribbon)?我想我必须使用此命名空间来获取 RibbonTextBox。我使用 VS2010 Express C#。
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#.