Value produced by BindingExpression is not valid for target property

Feb 1, 2013 at 1:57 PM
When scrolling horizontally in a DataGrid in a RibbonWindow, e.g. like this:

<ribbon:RibbonWindow x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ribbon="clr-namespace:Fluent;assembly=Fluent"
Width="300" Height="300">
    <DataGrid HeadersVisibility="Column">
        <DataGrid.Items>
            <TextBlock Text="bla"/>
        </DataGrid.Items>
        <DataGrid.Columns>
            <DataGridTextColumn Width="1000" />
        </DataGrid.Columns>
    </DataGrid>
</DockPanel>
</ribbon:RibbonWindow>

I get a lot of errors like this:

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='-0.161290322580385' BindingExpression:Path=CellsPanelHorizontalOffset; DataItem='DataGrid' (Name='datagrid'); target element is 'Button' (Name=''); target property is 'Width' (type 'Double')

This only happens in a RibbonWindow, not in a normal non-Ribbon Window.

Any idea what's going on?

(The ItemsPresenter in the DataGrid's controltemplate seems to round it's position to integers when in a RibbonWindow for some reason.)
Feb 14, 2013 at 11:55 AM
Apparently this is triggered by setting UseLayoutRounding to true in RibbonWindow's style.

It seems one can avoid the problem by disabling it again for the DataGrid:
<DataGrid UseLayoutRound="False" ...

The DataGrid does seem to be rendered a bit blurrier though.
Developer
Feb 15, 2013 at 9:19 PM
I will change the code, so it does not set UseLayoutRound="True" on the window-level anymore, but at ribbon-level instead.
If someone wants this activated they have to do it in their project.
Again i think we shouldn't mess around with WPFs default values of DisplayMode, LayoutRound etc. in a control library.