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
1280
XamDataGrid ComboBoxField population
posted

Hi,

I tried to follow Tacho's example.

 So far I managed to show a ComboBoxEditor in a field with correct data. But once a new items is selected the editor sets the item, but as soon as the editing is finished the item is set to null.

What am I doing wrong ?

<igDp:XamDataGrid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" DataSource="{Binding Path=ActiveClass.Students}" VerticalAlignment="Stretch">
            <igDp:XamDataGrid.FieldLayouts>
                <igDp:FieldLayout>
                    <igDp:Field Name="Id" Label="Id"/>
                    <igDp:Field AlternateBinding="{Binding Path=Gender.Name}" BindingType="Unbound" Label="Gender">
                        <igDp:Field.EditorStyle>
                            <Style TargetType="editors:XamComboEditor">
                                <Setter Property="ItemsSource" Value="{Binding Source={StaticResource GenderCollection}}" />
                                <Setter Property="DisplayMemberPath" Value="Name"/>
                                <Setter Property="SelectedItem" Value="{Binding Path=DataItem.Gender, Converter={StaticResource GenderObjectToGenderViewModelConverter}, ConverterParameter={StaticResource GenderCollection}}" />
                            </Style>
                        </igDp:Field.EditorStyle>
                    </igDp:Field>
                    <igDp:Field Name="Age" Label="Age"/>
                    <igDp:Field Name="Name" Label="Name" />
                </igDp:FieldLayout>
            </igDp:XamDataGrid.FieldLayouts>
        </igDp:XamDataGrid>

I have attached the project. (Not really allowed to attach the project of 2MB here, https://we.tl/t-tv4yqt7oWI )

Thanks in advance