如何创建样式文件 [英] how create file of style

查看:56
本文介绍了如何创建样式文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我在某些项目中使用了样式,图像等XAML块.是否可以为VB2008或VB2010项目创建类似于CSS文件的文件,并使用该文件代替复制和过去的样式,项目中的图像进行投射?

I used block of XAML like styles, images and so on in some projects. Is it possible create similar to CSS file for VB2008 or VB2010  project and use that file instead of copy and past styles, images from project to project?

谢谢.

推荐答案

您可以使用ResourceDictionary.然后,在资源下的Application.XAML(或与此相关的任何其他窗口或控件)中,您可以根据需要合并任意多个ResourceDictionary.

You can use a ResourceDictionary.  Then in Application.XAML (or any other window or control for that matter) under resources you can merge as many ResourceDictionarys as you want.

 

<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:YourAppName"
    StartupUri="Main.xaml"
ShutdownMode="OnMainWindowClose">
    
    <Application.Resources>
        
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>

                <ResourceDictionary Source="Themes and Styles/LightTheme.xaml"/>

            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>
    </Application.Resources>
</Application>


这篇关于如何创建样式文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆