none
How to make the specified control use the content of ResourceDictionary in app.xaml, and other controls in the page do not use the ResourceDictionary in app.xaml? RRS feed

  • Question

  • How to make the specified control use the content of ResourceDictionary in app.xaml, and other controls in the page do not use the ResourceDictionary in app.xaml?
    Wednesday, December 11, 2019 2:56 AM

All replies

  • Hi,

    You must give the style in ResourceDictionary a x:key.

     <Style TargetType="Button" x:Key="style1">
            <Setter Property="Background" Value="Black"/>
        </Style>

    then Button use it

     <Button Style="{StaticResource style1}"/>

    Best Regards,

    Alex


    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.

    Wednesday, December 11, 2019 6:45 AM
    Moderator