none
Cannot reference ResourceLibrary in Window control RRS feed

  • Question

  • I have a ResourceLibrary with a style defined:

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

          <Style x:Key="GlassButton1" TargetType="{x:Type Button}">
                <Setter Property="FontSize" Value="42" />
                <Setter Property="Foreground" Value="White" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">

        ....

    I have referenced this in App.xaml:

          <ResourceDictionary x:Key="Resources">
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="SteelBrush.xaml"/>
                    <ResourceDictionary Source="FullSteel.xaml"/>
                    <ResourceDictionary Source="/MindFusion.Gauges.Wpf;component/Themes/Leds.xaml" />
                    <ResourceDictionary Source="Librarries/WindowsTemplates.xaml"/>
                    <ResourceDictionary Source="ControlStyles.xaml"/>
                    <ResourceDictionary Source="ButtonnTemplates.xaml"/>
                    <ResourceDictionary Source="GlassButton1.xaml"/>
                    <ResourceDictionary Source="GlassButton.xaml"/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>

    Now I am trying to reference the style in a button and I get the error the reference cannot be resolved. What is wrong?

        <Button  Name="Mix_Designs" Margin="10 10 10 10" BorderBrush="Red" BorderThickness="2" Style="{StaticResource GlassButton1}">


    MeToo_

    Friday, November 1, 2019 1:47 PM

All replies

  • Hi MeToo_,

    To help you more accurately.

    I need more detail.

    What is your project?  UWP or WPF?

    Best regards,

    Strive


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 4, 2019 8:49 AM