我一直在尝试功能区控件并遇到可能的错误(或者我可能做错了什么)。如果我有一个RibbonTextBox
on the RibbonTab
,并设置已启用 to False or True在代码后面,我只能将其设置为 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 属性始终为 false http://connect.microsoft.com/VisualStudio/feedback/details/633097/ribbontextbox-isenabled-property-is-always-false
该链接还给出了可能的解决方法
更新:我自己尝试了这个解决方法,它确实有效
public class FixedRibbonTextBox : RibbonTextBox
{
protected override bool IsEnabledCore
{
get { return true; }
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)