Using XAML Resource Dictionary

Mar 12, 2016 at 8:12 AM
Hi,

I am launching a Window from the Ribbon and the window contains WPF code. When I style elements (say a button) in the xaml of the control it works fine, but when I try to include the same style as a resource dictionary to be used for all buttons launched in the addin it is ignored.

Is it possible to do this, i.e. to use resource dictionaries to style WPF code from within the addin, and if so how?

I defined a stand-alone xaml ResourceDictionary with a simple style as below, and set the xaml file as 'Embedded Resource". But the buttons don't get styled.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="Button">
        <Setter Property="BorderBrush" Value="Red"/>
        <Setter Property="BorderThickness" Value="2"/>
    </Style>

</ResourceDictionary>