0

In wpf, I created a resource dictionary and added a brush to it. How do I apply this to a button on a form?

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:MyProject">

        <LinearGradientBrush x:Key="OrangeGradient" EndPoint="0.5,1" StartPoint="0.5,0">
            <LinearGradientBrush.RelativeTransform>
                <TransformGroup>
                    <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                    <SkewTransform CenterY="0.5" CenterX="0.5"/>
                    <RotateTransform Angle="270" CenterY="0.5" CenterX="0.5"/>
                    <TranslateTransform/>
                </TransformGroup>
            </LinearGradientBrush.RelativeTransform>
            <GradientStop Color="#FFE08A19" Offset="0"/>
            <GradientStop Color="#FFF5CA86" Offset="1"/>
        </LinearGradientBrush>


</ResourceDictionary>

This is in a file, Styles.xaml, in a folder named Resources. In App.xaml under application.resources, I added the following, but it can't find the Styles.xaml:

<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
Patrick Schomburg
  • 2,494
  • 1
  • 18
  • 46

0 Answers0