Why is my style in Generic.xaml not working?

五迷三道 提交于 2019-12-04 16:54:37

You need to merge it into App.xaml like this:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Generic.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

If you are already doing that, you need to post your code to give more info.

EDIT: Try following the instructions here. Particularly, the parts about having to set your dictionaries to Resource and using the full path in Source.

I encountered this issue and the simplest fix for this is to remove the x:Key property of the style to be used in the ResourceDictionary.

<ControlTemplate TargetType="{x:Type Button}">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!