2012-05-05 63 views
4

我有一个关于WPF和RibbonControlsLibrary的问题。我试图自己找到这个错误的来源,但我似乎无法找到它。即使没有使用绑定,WPF和RibbonControlsLibrary也会抛出BindingExpression路径错误?

我正在使用Microsoft的WPF RibbonControlsLibrary。当使用RibbonToggleButton时,即使在我的XAML代码中没有任何绑定,我也会得到以下错误。

<r:RibbonWindow x:Class="WpfApplication.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="300" Width="300" 
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"> 
    <r:Ribbon> 
     <r:RibbonTab Header="Admin" > 
      <r:RibbonMenuButton/> 
     </r:RibbonTab> 
    </r:Ribbon> 
</r:RibbonWindow> 

System.Windows.Data Error: 39 : BindingExpression path error: 'IsChecked' property not found on 'object' ''RibbonMenuButton' (Name='')'. BindingExpression:Path=IsChecked; DataItem='RibbonMenuButton' (Name=''); target element is 'RibbonToggleButton' (Name='PART_ToggleButton'); target property is 'NoTarget' (type 'Object')

我有点被错误的最后一部分困惑:target element is RibbonToggleButton (Name='PART_ToggleButton'); target property is 'NoTarget' (type 'Object').有一个在我的XAML代码中没有RibbonToggleButton呢?

有人看到这样的行为,并能指出我正确的方向摆脱这种错误输出?

回答

5

我看到VS输出中的任何色带按钮错误。我试图解决它,但没有运气。不幸的是,我提出的唯一解决方案是它是您可以忽略的错误之一。

+0

有没有办法只抑制这个特定的错误? –

+0

它应该只出现在VS控制台中,除非您为它设置了一个记录器。 – kevindaub

1

查看MSDN上的RibbonMenuButton class documentation,我发现它使用PART_ToggleButton作为TemplatePart属性。 This article描述了TemplateParts如何工作。由于它被纳入控制,所以它可能是预期的行为。

更新:

看起来像WPF团队已经在评论here被告知了这个问题。也许它会在下一个版本中修复。

相关问题