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?
Thank you.
ItemSource for XamComboEditor is in VM,I can't put it in Xaml. If I did something 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" ItemSource="{Binding MyLookupList}" 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>
then, run the app, nothing bound for the popup list.
My data case is: VM is for the whole user control, XamGrid is bound an entitycollection in VM like ItemsSource="{Binding EntityCollectionForXamGrid, Mode=TwoWay}"
Not sure how to set up binding in xaml for this case.
HI,
You could use RelativesSource binding
For example.
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ig:XamGrid}, Path=DataContext.Orgs}".
Very helpful. Thanks.
I am attaching a new sample that addresses all your issues.
I am using commanding to get the selected value .
I set the XamComboEditor AutoComplete to true, and CustomValueEntered to Ignore
Sincerely, Matt Developer Support Engineer
Thank you. The binding is working perfectly, but the situation is still same as before. Choose one item from list, the click on any place out side of XamGrid, the selection will not accepted.
Another problem is:
If I set IsEditable ="True", then double click on the cell tp enter edit mode, the data will be the value from another property of MyEntity, which I never expect to be used.
Also, any typing will cause a error and crash the app.
Any property can be set to resolve this issue for XamComboEditor?