Hi,
below is the code of one of the unbound column i've used in xamdatagrid.
this column has xamcomboeditor that suppose to be bounded to the property of the DataItem which is of type Enum.
to show the user proper text I've used EnumToString converter to convert enum to Text. this class returns Dictionary<string,Enum> which is later bound to the xamcomboeditor.
<igDP:UnboundField BindingPath="SelectedSubmitMethod" Label="Submit Method" Width="50" Column="2" Row="1" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" LabelWidth="0" AutoSizeScope="RecordsInView" DataValueChangedNotificationsActive="True" >
<igDP:FieldSettings.EditorStyle >
<Style TargetType="{x:Type igEditors:XamComboEditor}">
<!--<Setter Property="ItemsSource" Value="{Binding Path=DataItem.AvailableSubmitMethods, Converter={StaticResource ResourceKey=EnumToStringConverter}, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />-->
<Setter Property="ItemsSource">
<Setter.Value>
<Binding Path="DataItem.SelectedSubmitMethod" Converter="{StaticResource ResourceKey=EnumToStringConverter}" UpdateSourceTrigger="PropertyChanged" FallbackValue="Print" NotifyOnValidationError="True" >
</Binding>
</Setter.Value>
</Setter>
<Setter Property="DisplayMemberPath" Value="Key"/>
<Setter Property="ValuePath" Value="Value"/>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:UnboundField.Settings>
</igDP:UnboundField>
------------------------------------------------------------------------------------------------------------------------------------------
when i used
<Setter Property="ItemsSource" Value="{Binding Path=DataItem.AvailableSubmitMethods, Converter={StaticResource ResourceKey=EnumToStringConverter}, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />
it failed with below errors:
System.Windows.Data Error: 40 : BindingExpression path error: 'Value' property not found on 'object' ''Char' (HashCode=7602292)'. BindingExpression:Path=Value; DataItem='Char' (HashCode=7602292); target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'Key' property not found on 'object' ''Char' (HashCode=7602292)'. BindingExpression:Path=Key; DataItem='Char' (HashCode=7602292); target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
Looks like you are using different path values in the two ItemsSource values.
The working version is using Path=DataItem.AvailableSubmitMethods.
The non-working version is using Path="DataItem.SelectedSubmitMethod" and passing FallbackValue="Print".
HI,
I haven't heard back from you and I'm wondering if there is anything further I can help with regarding your initial question.
If so, please feel free to contact me.
I wanted remove binding expression errors because they are making Rendering of screen slow (I suppose, correct me if I am wrong).
One of the binding error is "System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=ItemsProvider.DisplayMemberPath; DataItem='XamComboEditor' (Name='WPFEditor'); target element is 'ComboBox' (Name='PART_FocusSite'); target property is 'DisplayMemberPath' (type 'String')"
We are using following type of code, can you please help:
<rEditor:ComboEditor Name="rcboXLTreatyType" Grid.Row="4" Grid.Column="3" Caption="XL Tty Type" EditorWidth="95" LabelWidth="100" IsReadOnly="True" Text="{Binding Path=XLType, Mode=TwoWay, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged}"/>
<rEditor:ComboEditor Name="rcboLead" Grid.Row="2" Grid.Column="1" Caption="Lead" LabelWidth="55" EditorWidth="65" Visibility="Collapsed" Text="{Binding Path=HeaderLead, Mode=TwoWay, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged}" />
Hi Shukla,
Sorry that your question was not responded to sooner.
Before I try to answer it, let me first confirm that you are working with the xamRibbon ComboEditor tool.
I’m afraid I will need a sample that demonstrates the exception. The controls that you showed me don’t appear to be XamComboEditors, although the exception is pointing to a XamComboEditor.
This link may be helpful to you in Debugging WPF data bindings
http://www.codeproject.com/Articles/244107/Debugging-WPF-data-bindings
I look forward to working with you.