wpf资源字典使用converter?如何在字典中引用字典?

wpf资源字典使用converter?如何在字典中引用字典?,第1张

只要在App.xaml里面添加字典的时候按先后顺序就可以了

<Application.Resources>

        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>

                <ResourceDictionary Source="Skin/BrushResources.xaml"/>

                <ResourceDictionary Source="Skin/ImageResources.xaml"/>

                <ResourceDictionary Source="Skin/AppResources.xaml"/>

            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>

    </Application.Resources>

如上述代码所示,AppResources.xaml里面用到BrushResources.xaml里面的资源

首先在页面里合并资源字典,放在<Window.Resources>或<Page.Resources>

<ResourceDictionary>

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary

Source="资源字典名.xaml"/>

</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

然后在后台指定即可。

控件名.Style

=

Resources["样式的Key"]

as

Style


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11652145.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存