To define WPF resources in a stand-alone file

Source: Internet
Author: User


I. Overview of the article

This presentation describes how to define WPF resources in a separate file and invoke the relevant resource files where needed.
Related Downloads (code, screen recording): Http://pan.baidu.com/s/1sjO7StB
Play Online: http://v.youku.com/v_show/id_XODExODg0MzIw.html
Warm Tips: If the screen recording and code can not be downloaded properly, you can leave a message in the station, or send an email to [email protected]

First, define the resources in a separate file
The XAML code looks like this:
<resourcedictionary xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation"                    xmlns:x= "http// Schemas.microsoft.com/winfx/2006/xaml "                    xmlns:sys=" Clr-namespace:system;assembly=mscorlib ">    <sys: String x:key= "Text" > Road long its repair far XI, I will go up and down and quest! </sys:String></ResourceDictionary>

Iii. Connect to a separate resource file where resources are used
The XAML code is as follows:
<window x:class= "Demo009.mainwindow"        xmlns= "Http://sche1mas.microsoft.com/winfx/2006/xaml/presentation"        xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"        title= "Resource Files" fontsize= ">    <Window.Resources>        <resourcedictionary source=" Shinyred.xaml "/>    </Window.Resources>    <StackPanel>        <textblock text=" { StaticResource text} "/>    </StackPanel></Window>

Follow the code above, even if it's done!

To define WPF resources in a stand-alone file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.