Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
XamComboEditor Binding fails
posted

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 works fine, but when i used 

<Setter Property="ItemsSource">

                                                <Setter.Value>

                                                    <Binding Path="DataItem.SelectedSubmitMethod" Converter="{StaticResource ResourceKey=EnumToStringConverter}" UpdateSourceTrigger="PropertyChanged"  FallbackValue="Print" NotifyOnValidationError="True" >

                                               </Binding>

                                                </Setter.Value>

                                            </Setter>

 

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

Can someone please point out what am i doing wrong here?
Thanks