Ticket Q359790
Visible to All Users

CheckedComboBoxStyleSettings

created 13 years ago

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

Answers

created 13 years ago (modified 8 years ago)

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

    Show previous comments (3)
    DevExpress Support Team 8 years ago

      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?

        DevExpress Support Team 8 years ago

          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.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.