-
-
Hello,
we use MultiBinding in DataColumn, it works fine. But it will have some warning display in output window, is there a way to remove it?
I attach a simple app to show this issue:
System.Windows.Data Warning: 40 : BindingExpression path error: 'Position' property not found on 'object' ''RowTypeDescriptor' (HashCode=34837951)'. BindingExpression:Path=Data.Position.X; DataItem='EditGridCellData' (HashCode=32027802); target element is 'EditGridCellData' (HashCode=32027802); target property is 'DisplayMemberBindingValue' (type 'Object')
Thanks
Ella
<dxg:GridColumn Header="Position">
<dxg:GridColumn.DisplayMemberBinding>
<MultiBinding Converter="{local:PositionConverter}">
<Binding Path="Data.Position.X" RelativeSource="{RelativeSource Self}"/>
<Binding Path="Data.Position.Y" RelativeSource="{RelativeSource Self}"/>
<Binding Path="Data.Position.Z" RelativeSource="{RelativeSource Self}"/>
</MultiBinding>
</dxg:GridColumn.DisplayMemberBinding>
</dxg:GridColumn>
-
-
1 Solution
Hi Ella,
You don't need to specify a source for binding in the DisplayMemberBinding expression. When this binding expression is resolved, the underlying data object is placed in the data context. So, if the underlying data object has the Position property, the binding expression should look like this:
[XAML] Open in popup window<dxg:GridColumn Header="Position"> <dxg:GridColumn.DisplayMemberBinding> <MultiBinding Converter="{local:PositionConverter}"> <Binding Path="Position.X" /> <Binding Path="Position.Y" /> <Binding Path="Position.Z" /> </MultiBinding> </dxg:GridColumn.DisplayMemberBinding> </dxg:GridColumn>
Edited by Vito (DevExpress Support), July 05, 2012:
It appears that there is a problem with resolving binding expressions when MultiBinding is set. We will examine what causes this problem.
In the meantime, please use the following code to address this problem:
[XAML] Open in popup window<dxg:GridColumn Header="Position"> <dxg:GridColumn.DisplayMemberBinding> <MultiBinding Converter="{local:PositionConverter}"> <Binding Path="RowData.Row.Position.X" RelativeSource="{RelativeSource Self}"/> <Binding Path="RowData.Row.Position.Y" RelativeSource="{RelativeSource Self}"/> <Binding Path="RowData.Row.Position.Z" RelativeSource="{RelativeSource Self}"/> </MultiBinding> </dxg:GridColumn.DisplayMemberBinding> </dxg:GridColumn>
I am attaching the modified sample project, in which this approach is used. Please try it on your side and let us know how it goes.
-
ella sun 4 years ago
I'm afraid this method is not working, and position could not display. the test is based on my attachment, it's a simple project, please try to fix it, thanks
-
Vito (DevExpress Support) 4 years ago
Hello Ella,
It appears that there is a problem with resolving binding expressions when MultiBinding is set. I have updated the answer Ted posted, and we will examine what causes this problem.
In the meantime, please use the workaround I described in that answer.
-
ella sun 4 years ago
It solved the problem, Thank you for your help!