我面临输出窗口中提到的绑定错误,如下所示。
错误:
" System.Windows.Data错误:40:BindingExpression路径错误: ' IsDropDownOpen'在' object'上找不到的属性'' SaveEnterpriseView' (名称='')&#39 ;. BindingExpression:路径= IsDropDownOpen; 的DataItem =' SaveEnterpriseView' (名称='&#39);目标元素是 ' RibbonButton' (名称='&#39);目标财产是“NoTarget' (类型 '对象')"
这是我的xaml代码:
<UserControl x:Class="Project1.Views.SaveEnterpriseView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ribbon="clrnamespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
xmlns:base="clr-namespace:Project1.WPF;assembly=Project1">
<UserControl.Template>
<ControlTemplate>
<ribbon:RibbonButton Command="{BindingSaveEnterpriseCommand}" Label="{base:TextID _SaveEnterprise}" />
</ControlTemplate>
</UserControl.Template>
</UserControl>
从这个链接WPF Ribbon: DataTemplate causes BindingExpression path error,我认为这个问题与ribbonbutton本身有关。但我能够找到解决方法。