Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF and RibbonControlsLibrary throws a BindingExpression path error without even using Bindings?

I have a question regarding WPF and RibbonControlsLibrary. I tried to find the source of this error myself but I just do not seem to be able to find it.

I am using the WPF RibbonControlsLibrary from Microsoft. When using the RibbonToggleButton I get the following error even without any bindings in my XAML code.

<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')

I am a bit confused by the last part of the error: target element is RibbonToggleButton (Name='PART_ToggleButton'); target property is 'NoTarget' (type 'Object'). There is no RibbonToggleButton in my XAML code at all?

Did someone else see such a behavior and is able to point me into the right direction to get rid of this error output?

like image 626
Thomas Huber Avatar asked May 05 '12 13:05

Thomas Huber


2 Answers

I see that error in the VS output for any ribbontogglebutton. I have attempted to resolve it, but with no luck. Unfortunately, the only fix I have come up with is that it's one of those errors you can ignore.

like image 134
kevindaub Avatar answered Sep 27 '22 17:09

kevindaub


Looking at the RibbonMenuButton class documentation on MSDN I see that it uses PART_ToggleButton as a TemplatePart attribute. This article describes how TemplateParts work. Since it's baked into the control it's probably expected behavior.

Update:

Looks like the WPF team has been notified of the problem in the comments here. Perhaps it will be fixed in the next release.

like image 20
Dan Busha Avatar answered Sep 27 '22 17:09

Dan Busha