I have a ComboBoxItemsProvider that I am using for my editor style and I need to set its ItemsSource property to a List<Customer> which is generated in code behind when the page loads. There is no Name property so I can't expose it through XAML to my code behind and if I use a DynamicResource the combox is empty and the control doesn't support the ObjectDataProvider.
So the question is, how can I fill a combobox in the grid with a generic list that is generated when a code behind method is called?
Thanks!!
Hello,
You can set the ItemsSource as DynamicResource like that :
void Window1_Loaded(object sender, RoutedEventArgs e)
{
xamDataGrid2.Resources.Add("pr", list);
}
<igDP:UnboundField Label="Last Name" >
<igDP:Field.Settings>
<igDP:FieldSettings >
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsSource" Value="{DynamicResource pr}" />
<Setter Property="DisplayMemberPath" Value="LastName" />
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:UnboundField>
Hope this helps
Vlad
That did work and thank you for the help!!
I was following the example in the feature browser for using a combo box as the field editor and it was using a ComboBoxItemsProvider rather than a ComboBox but I still couldn't get it to work by using a DynamicResource.
Can you tell me what would be the benefit of using the ComboBoxItemsProvider over the regular ComboBox?
You can refer to online documentation for more details about the ItemsSource and ItemsProvider properties of XamComboEditor:
http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/Infragistics3.Wpf.Editors.v8.2~Infragistics.Windows.Editors.XamComboEditor~ItemsSource.html
http://help.infragistics.com/Help/NetAdvantage/WPF/2008.2/CLR3.X/html/Infragistics3.Wpf.Editors.v8.2~Infragistics.Windows.Editors.ComboBoxItemsProvider.html
Let me know if you have any questions on that.