Applying a theme to RichTextBoxExtended

Ribbon for WPF Forum

Posted 16 years ago by Michael.Ehlert
Version: 4.5.0484
Hi everybody.

I'm using the lines:

Uri uri = new Uri("PresentationFramework.Classic;V3.0.0.0;31bf3856ad364e35;component\\themes/classic.xaml", UriKind.Relative);
Resources.MergedDictionaries.Add(Application.LoadComponent(uri) as ResourceDictionary);

to apply a specific theme to my application. This is working fine for all standard controls (like RichTextBox) but doesn't work for RichTextBoxExtended controls (which are still shown with the default os theme). I do have a lot of subclasses in my app and all do have the same problem. All of them are based on the RichTextBoxExtended example, like xbsTextBox : TextBox, the main goal is to provide some additional DependencyProperties and different context menues for the controls.

Every hint is apreciated. Michael

Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Michael,

This is something that we have run into also. There are three types of styles: Explicit, Implicit, and Default (or theme). Explicit Styles are set via the Style property on the FrameworkElement. Implicit Styles are defined as a resource that uses the control type as it's key. Finally, the Default Styles are defined like Implicit Styles but are contained in the resource dictionary loaded for the theme.

Now assume you have a BaseControl and DerivedControl, like so:
    public class BaseButton : Button {
        static BaseButton() {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(BaseButton), new FrameworkPropertyMetadata(typeof(BaseButton)));

    public class DerivedButton : BaseButton {
        // Inherits default value for DefaultStyleKeyProperty
When looking for a Default Style for DerivedButton, WPF will use a Style whose key is BaseButton. When looking for an Implicit Style for DerivedButton, WPF will *not* use a Style whose key is BaseButton. For Implicit Styles, the type must match exactly.

This is documented under "The Style Property" section here (

We do have a workaround, which we can provide through email (just send a message to our support address).

[Modified at 01/22/2009 08:36 AM]

Actipro Software Support

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.