Hi,
I am using a WPF ComboboxEdit with CheckedComboBoxStyleSettings. What I need to do is add a attached property to every item in the combo. I wanted to do this by using the ItemContainerStyle, but that gets overriden by CheckedComboBoxStyleSettings.
It looks something like this:
<dxe:ComboBoxEdit x:Name="ChainsCombo" ItemsSource="{Binding Chains}"
SelectedItem="{Binding SelectedChain}"
DisplayMember="Name">
<dxe:ComboBoxEdit.StyleSettings>
<dxe:CheckedComboBoxStyleSettings/>
</dxe:ComboBoxEdit.StyleSettings>
<dxe:ComboBoxEdit.ItemContainerStyle>
<Style>
<Setter Property="AutomationProperties.AutomationId" Value="{Binding ., Converter={StaticResource dataContextToAutomationIdConverter}}"/>
</Style>
</dxe:ComboBoxEdit.ItemContainerStyle>
</dxe:ComboBoxEdit>
If you remove the CheckedComboBoxStyleSettings, the property is set. Is there any good way of applying this attached property to every item?
Thank you,
Gabi
CheckedComboBoxStyleSettings
Answers
Hello,
Thank you for the question. Our CheckedComboBoxStyleSettings use the predefined style for an item container. You can override this style and set the attached property there. Please review the attached sample.
[Updated]
Starting with version 16.1, the default application theme is "Office2016White". So, please use the IsThemeIndependent property to apply the "{themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle}" template to the ComboBoxEditItem control in the "Office2016White" application theme. Here is a corresponding XAML snippet:
XAML<Style TargetType="dxe:ComboBoxEditItem" x:Key="{themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle, IsThemeIndependent=True}" BasedOn="{StaticResource {themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle}}">
<Setter Property="local:MainWindow.TestProperty" Value="OK"/>
<Style.Triggers>
<Trigger Property="local:MainWindow.TestProperty" Value="OK">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</Style.Triggers>
</Style>
Thanks,
Dima
Hello Joachim,
Starting with version 16.1, the default application theme is "Office2016White". So, please use the IsThemeIndependent property to apply the "{themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle}" template to the ComboBoxEditItem control in the "Office2016White" application theme. Here is a corresponding XAML snippet:
C#<Style TargetType="dxe:ComboBoxEditItem" x:Key="{themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle, IsThemeIndependent=True}" BasedOn="{StaticResource {themes:EditorListBoxThemeKey ResourceKey=CheckBoxItemStyle}}">
<Setter Property="local:MainWindow.TestProperty" Value="OK"/>
<Style.Triggers>
<Trigger Property="local:MainWindow.TestProperty" Value="OK">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</Style.Triggers>
</Style>
Thanks,
Elliot
Thank you!
This works. Is it also possible to not select disiabled items when "Select all" is pressed?
Hello Joachim,
I've created a separate ticket on your behalf (T440857: How to not select disiabled items when "Select all" is pressed?). It has been placed in our processing queue and will be answered shortly.