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.