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
4970
how to make XamComboEditor accept the selection automatically when lost focus?
posted

Put a XamComboEditor in a XamGrid templatecolumn like:

<ig:TemplateColumn Key="Organization" HorizontalContentAlignment="Stretch" Width="320">
    <ig:TemplateColumn.HeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding GridHeaderStrings.Name, Source={StaticResource ResourceWrapper}}" />
        </DataTemplate>
    </ig:TemplateColumn.HeaderTemplate>
    <ig:TemplateColumn.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Vertical">
                <TextBlock x:Name="NameDisplay" Text="{Binding MyEntity.ID,Converter={StaticResource IDToNameConverter}}" HorizontalAlignment="Stretch" />
            </StackPanel>
        </DataTemplate>
    </ig:TemplateColumn.ItemTemplate>
    <ig:TemplateColumn.EditorTemplate>
        <DataTemplate>
            <ig:XamComboEditor x:Name="MyEntityEditList" IsEditable="False"
         SelectedItem="{Binding MyEntity, Mode=TwoWay}" Width="310">
                <ig:XamComboEditor.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding ID,Converter={StaticResource IDToNameConverter}}" Margin="5" VerticalAlignment="Center" />
                        </StackPanel>
                    </DataTemplate>
                </ig:XamComboEditor.ItemTemplate>
            </ig:XamComboEditor>
        </DataTemplate>
    </ig:TemplateColumn.EditorTemplate>
</ig:TemplateColumn>

Set up ItemSource for XamComboEditor in CellEnteredEditMode event of XamGrid. I have a few problem with XamComboEditor in this case:

1. When users choose one item from popup dropdown with mouse, then click on another other control out XamGrid, the selection will not be accepted. In order to fix this problem, I need to advise users: select one item from dropdown, then hit Tab key, then do something else.

2. I want to change XamComboEditor to be editable in this case by adding:

IsEditable="true"  AllowFiltering="True"

then run the app, the app is crashed with cascade exception.

How to fix the problem for this case?