I can't directly bind a xamComboEditor to an IList of KeyValuePair and have the key as the display text and the value as the, well, value.
I think I can get around this either with:
(1) a plain WPF ComboBox and a DataTemplate or
(2) by sticking with the xamComboEditor and creating an object with two properties on it for each item in the IList and using the DisplayMemberPath and ValuePath.
Which would you do?
At the moment I'm trying option (3)! I'm wrapping a plain WPF ComboBox in a xamComboEditor. This shows the correct list of values in the drop down list but doesn't manage the Key properly. Where am I going wrong?
<Style x:Key="CorporateActionDateComboStyle" TargetType="{x:Type ComboBox}"> <Setter Property="ItemsSource" Value="{Binding Path=DataContext.CorporateActionDates, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> <TextBlock Text="{Binding Path=Value}" /> </DataTemplate> </Setter.Value> </Setter></Style><Style x:Key="CorporateActionDateFieldStyle" TargetType="{x:Type Editors:XamComboEditor}"> <Setter Property="ComboBoxStyle" Value="{StaticResource CorporateActionDateComboStyle}"/></Style>
public IList CorporateActionDates{ get { // IList<KeyValuePair<Enum, string>> IList list = typeof(CorporateActionDate).ToList();
return list; }}
The first of the two sounds simpler. If you already know how you can solve this with a ComboBox and a DataTemplate, then you can apply that same solution to a XamComboEditor. Here is a post that shows how to do just that:
http://forums.infragistics.com/forums/p/31432/231961.aspx#231961
Please let me know if you need further assistance.
Thank you,
The whistle of the wind, a brushwood rolling down the main street of the ghost town.