How can I create a style for the XamComboEditor so it has alternating backbround like the XamDataGrid?
I'm not sure I follow. In the snippet I provided that setter was in the Style that targets the ComboBox class and is set as the value of the ComboBoxStyle property.
Thanks. I get the following error:
Cannot find the Style Property 'ItemContainerStyle' on the type 'Infragistics.Windows.Editors.XamComboEditor'.
my project is .net 3.5 and I'm running windows 7 with all available updates installed, so I asume I'm using .net 3.5 sp1. Any ideas why it doesnt recognize that property? I put this style in a resource dictionary in a seperate file which includes the following references:
xmlns:igwindows="http://infragistics.com/Windows"xmlns:igEditors="http://infragistics.com/Editors" xmlns:luna="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"xmlns:igThemes="http://infragistics.com/Themes">
Another option if you are using .net 3.5 sp1 or later is to provide a custom style for the contained ComboBox and set its AlternationCount and use the AlternationIndex on the comboboxitem's style. e.g.
Hello,
I think there is no direct way of achieving this, but you can use a IMultiValueConverter and see at which position is the ComboBoxItem inside the XamComboEditor and change the background according to that, like so:
<igEditors:XamComboEditor Name="xamComboEditor1">
<igEditors:XamComboEditor.Resources>
<local:MyConverter x:Key="conv"/>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" >
<Setter.Value>
<MultiBinding Converter="{StaticResource conv}">
<MultiBinding.Bindings>
<Binding />
<Binding Path="ItemsProvider" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type igEditors:XamComboEditor}}" />
</MultiBinding.Bindings>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</igEditors:XamComboEditor.Resources>
</igEditors:XamComboEditor>
and the convert method:
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (values == null)
return Binding.DoNothing;
else
ComboBoxItemsProvider pr = values[1] as ComboBoxItemsProvider;
if (pr.Items.IndexOf(values[0]) % 2 == 0)
return Brushes.Orange;
return Brushes.OldLace;
}