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 Hemant,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into it and I am wondering if you could send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Hello Stefan,
here is my code (Silverlight)
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<ig:XamComboEditor>
ItemSource="{Binding Source={StaticResource DataContextProxy}, Path=NameIdList}"
DisplayMemberPath="Name"
IsEditable="True"
AutoComplete="True"
SelectedItem="{Binding NameID, Mode=TwoWay}"
</ig:XamComboEditor>
</DataTemplate>
One problem I am facing is, when i hit backspace key, it gets busted saying 'index was out of range. Must be non -ve'
Please advise.
Hello Vijay,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Hi Stefan,
Thanks for the sample.
I see that you prepared the sample in WPF, however, I am working in a Silverlight application, but, I guess things will be similar and see if I could extract things of interest from your sample.
I'll let you know once I am done with it.
Thanks again.
Hello,
I have created a sample project for you with the functionality you want. Basically I set the TempalteColumn’s ItemTempalte, so that the value of the cell could show when not in edit mode. Also I commented a code showing how to get the UserControl’s Resources. Please let me know if this helps you or you need further assistance on this matter.