ribbon:ComboBox Style

Ribbon for WPF Forum

Posted 15 years ago by Jon Cain - Software Architect, AutoMon Corporation
Version: 9.1.0500
Avatar
I want to add a Margin everywhere a ribbon:ComboBox is located. I added the following style to App.xaml:

  <Style TargetType="{x:Type ribbon:ComboBox}" >
    <Setter Property="Margin" Value="2" />
  </Style>
And this works, except the margin style is wiped out when I change themes.

Any ideas?

[Modified at 06/15/2009 06:00 PM]

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Jon,

The ThemeManager (and thus theme switching) works by merging the appropriate theme files into the appropriate Resources collection. When using ThemeManager.CurrentTheme, the theme files are merged into the App.Resources. When using ThemeManager.SetTheme(DependencyObject,string), the theme files are merged into the Resources of the specified object.

So even if you put your implicit Style in the App resources, it will be a lower priority than the theme files merged using SetTheme (since they would be loaded after your implicit Style). You would need to use the CurrentTheme property, or define your implicit Style in the Resources for the object you pass to SetTheme.

Keep in mind that if you are using the attached property ThemeManager.ThemeProperty, then that is the same as calling SetTheme.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.