Question about using WPF theme elements in Style's BasedOn

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 11 years ago by Craig - Varigence, Inc.
Version: 10.1.0522
Avatar
In my WPF application, I have ComboBoxes in several places and currently use a large ResourceDictionary as a theme file. While I don't want to replace that theme with an Actipro theme, I do want to use the Actipro ComboBox style for my controls.

I already have a ComboBox style in my theme file so I intended to do the following:

    <Style 
        TargetType="{x:Type ComboBox}"
        BasedOn="{StaticResource editorsThemes:EditorsCommonDictionary.NativeComboBoxStyleKey}"
        >
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
        ...
    </Style>
However, I got an error indicating that component resource keys cannot be used in BasedOn. I tried other variations but none worked.

Is there a proper way to build a ComboBox style that is based on a ComboBox style from Actipro themes?

Thanks,

-Craig

Comments (1)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The BasedOn value that you are using is close, but a minor change is necessary for it to work:

Assuming:
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"

BasedOn="{StaticResource {x:Static themes:EditorsCommonDictionary.NativeComboBoxStyleKey}}"

Please let us know if you have further questions.


Actipro Software Support

The latest build of this product (v21.1.3) was released 14 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.