Hi,
I am trying to add XamComboEditor to a XamGrid column.
I want to set the ItemSource of this XamComboEditor via code, it is dynamic and it'll keep changing means I'll change the itemsource to other collection as well.
Want to allow user to either select from existing, or let Enter new value in the cell.
I used below code to get the xamcomboeditor in my grid:
<ig:TemplateColumn Key="Band" IsReadOnly="False"> <ig:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock x:Name="DisplayName" Text="{Binding}" /> </DataTemplate> </ig:TemplateColumn.ItemTemplate> <ig:TemplateColumn.EditorTemplate> <DataTemplate> <ig:XamComboEditor IsEditable="True" CustomValueEnteredAction="Add" ItemsSource="{Binding}" SelectedItem="{Binding}"> <ig:XamComboEditor.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}"/> </DataTemplate> </ig:XamComboEditor.ItemTemplate> </ig:XamComboEditor> </DataTemplate> </ig:TemplateColumn.EditorTemplate> </ig:TemplateColumn>
I am not getting as how to set the itemsource to this column via code (at runtime)
Any suggestions/directions?
Hello,
Thank you for your post. I have been looking into it and I can suggest you see this forum thread:
https://ko.infragistics.com/community/forums/f/retired-products-and-controls/72619/xamgrid-combobox-column-binding/367482#367482
where a similar issue is discussed. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
hi.
Thanks for the link.
1. i created a List<ofmyclass> cmbStore as a property of MainPage (this list need to be set as itemssource to xamcomboeditor in the grid column)
2. declared xmlns:local,
xmlns:local="clr-namespace:NameSpaceOfMainPage"
3. declared <UserControl.Resources> as
<UserControl.Resources> <local:MainPage x:Key="cbs" /> </UserControl.Resources>
3. set the templatecolumn in the xamgrid as :
<ig:TemplateColumn Key="KeyInGridDataSource" IsReadOnly="False"> <ig:TemplateColumn.EditorTemplate> <DataTemplate> <ig:XamComboEditor x:Name="gridXamComboEditor" IsEditable="True" CustomValueEnteredAction="Add" ItemsSource="{Binding Source={StaticResource cbs}, Path=cmbStore}" SelectedItem="{Binding ID}"> <ig:XamComboEditor.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding ID}"/> </DataTemplate> </ig:XamComboEditor.ItemTemplate> </ig:XamComboEditor> </DataTemplate> </ig:TemplateColumn.EditorTemplate> </ig:TemplateColumn>
However, it fails to load and throwing StackOverflowExcpetion on InitializeComponent() call in MainPage constructor! :(
Couldn't think of what am i missing here.