<Window x:Class="Demos.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Lable" Height="23" HorizontalAlignment="Left" Margin="32,30,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<Button Content="TextBlock" Height="23" HorizontalAlignment="Left" Margin="32,59,0,0" Name="button2" VerticalAlignment="Top" Width="75" Click="button2_Click" />
<!--引用DictionaryResource1.xaml-->
<Button Style="{StaticResource btnStyle2}" Content="B12" Height="23" HorizontalAlignment="Left" Margin="88,110,0,0" Name="button3" VerticalAlignment="Top" Width="75" />
<Button Content="Combobox" Height="23" HorizontalAlignment="Left" Margin="122,30,0,0" Name="button4" VerticalAlignment="Top" Width="75" Click="button4_Click" />
<Button Content="5" Height="23" HorizontalAlignment="Left" Margin="122,59,0,0" Name="button5" VerticalAlignment="Top" Width="75" />
<Button Content="6" Height="23" HorizontalAlignment="Left" Margin="122,88,0,0" Name="button6" VerticalAlignment="Top" Width="75" />
<Button Content="7" Height="23" HorizontalAlignment="Left" Margin="220,30,0,0" Name="button7" VerticalAlignment="Top" Width="75" />
<Button Content="8" Height="23" HorizontalAlignment="Left" Margin="220,59,0,0" Name="button8" VerticalAlignment="Top" Width="75" />
<Button Content="9" Height="23" HorizontalAlignment="Left" Margin="220,88,0,0" Name="button9" VerticalAlignment="Top" Width="75" />
<Button Content="10" Height="23" HorizontalAlignment="Left" Margin="314,30,0,0" Name="button10" VerticalAlignment="Top" Width="75" />
<Button Content="11" Height="23" HorizontalAlignment="Left" Margin="314,59,0,0" Name="button11" VerticalAlignment="Top" Width="75" />
<!--引用Dictionary2.xaml-->
<Button Style="{StaticResource btnStyle1}" Content="12" Height="23" HorizontalAlignment="Left" Margin="314,88,0,0" Name="button12" VerticalAlignment="Top" Width="75" />
</Grid>
</Window>
using System.Windows;

namespace Demos
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
} private void button1_Click(object sender, RoutedEventArgs e)
{
Window1 w = new Window1();
w.ShowDialog();
} private void button2_Click(object sender, RoutedEventArgs e)
{
TextBlockDemo t = new TextBlockDemo();
t.ShowDialog();
} private void button3_Click(object sender, RoutedEventArgs e)
{
ButtonDeom b = new ButtonDeom();
b.Show();
} private void button4_Click(object sender, RoutedEventArgs e)
{
ComboboxDemo c = new ComboboxDemo();
c.ShowDialog();
}
}
}

Lable==>

<Window x:Class="Demos.TextBlockDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TextBlockDemo" Height="300" Width="300">
<StackPanel>
<TextBlock>
<Run FontSize="20" TextDecorations="underline" Text="段誉啊啊啊啊啊"/>
<Run FontSize="15" Foreground="Red" Text="凌波微步"/>
<Run FontSize="20" Foreground="Chartreuse" Text="打不着"/>
</TextBlock>
</StackPanel>
</Window>

Combobox==>

<Window x:Class="Demos.ComboboxDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ComboboxDemo" Height="300" Width="300">
<Grid>
<ComboBox IsEditable="True" Height="23" HorizontalAlignment="Left" Margin="39,51,0,0" Name="comboBox1" VerticalAlignment="Top" Width="202" >
<StackPanel Orientation="Horizontal" TextSearch.Text="李若彤">
<Image Source="image/yuyan.jpg"/>
</StackPanel>
<StackPanel Orientation="Horizontal" TextSearch.Text="刘涛">
<Image Source="image/azhu.jpg"/>
</StackPanel>
</ComboBox> <ComboBox IsEditable="True" Height="23" TextSearch.TextPath="Name" HorizontalAlignment="Left" Margin="39,100,0,0" Name="comboBox2" VerticalAlignment="Top" Width="202" >
<StackPanel Orientation="Horizontal" Name="李若彤">
<Image Source="image/yuyan.jpg"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Name="刘涛">
<Image Source="image/azhu.jpg"/>
</StackPanel>
</ComboBox>
</Grid>
</Window>
Dictionary2.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="btnStyle2" TargetType="{x:Type Button}">
<Setter Property="Height" Value="50"/>
<Setter Property="Margin" Value="35,0,0,0"/>
<Setter Property="Background" Value="Beige"/>
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="60"/>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary> DictionaryResource1.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="btnStyle1">
<Setter Property="Button.Height" Value="50"/>
<Setter Property="Button.Margin" Value="35,0,0,0"/>
<Setter Property="Button.Background" Value="Beige"/>
<Setter Property="Button.RenderTransform">
<Setter.Value>
<RotateTransform Angle="45"/>
</Setter.Value>
</Setter>
</Style>
<!--<Style x:Key="btnStyle2" TargetType="{x:Type Button}">
<Setter Property="Height" Value="50"/>
<Setter Property="Margin" Value="35,0,0,0"/>
<Setter Property="Background" Value="Beige"/>
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="60"/>
</Setter.Value>
</Setter>
</Style>-->
</ResourceDictionary>

运行效果:

WPF Demo9外部资源文件的更多相关文章

  1. ArcGIS for WPF 访问外部资源【进阶之构造URL】

    原文 http://www.cnblogs.com/wdysunflower/archive/2013/05/29/3039645.html 呵呵~好久没逛园子,没写博客了. 最近刚好又在弄GIS这块 ...

  2. ArcGIS for WPF 访问外部资源

    原文 http://www.cnblogs.com/wdysunflower/archive/2011/07/14/2105584.html ArcGIS for WPF 访问外部资源 应用背景: 因 ...

  3. 总结:WPF中ResourceDictionary资源文件的查找和遍历方法

    原文:总结:WPF中ResourceDictionary资源文件的查找和遍历方法 一.查找包含制定关键字的资源 ResourceDictionary GetThemeDictionary()     ...

  4. spark-submit --files 动态加载外部资源文件

    在做spark时,有些时候需要加载资源文件,需要在driver或者worker端访问.在client模式下可以使用IO流直接读取,但是在cluster模式下却不能直接读取,需要如下代码: val is ...

  5. Spark动态加载外部资源文件

    Spark动态加载外部资源文件 1.spark-submit --files 动态加载外部资源文件 之前做一个关于Spark的项目时,因项目中需要读取某个静态资源文件,然后在本地IDEA测试一切皆正常 ...

  6. wpf 前台获取资源文件路径问题

    1 <ImageBrush ImageSource="YT.CM.CommonUI;component/Resource/FloadwindowImage/middle.png&quo ...

  7. ThinkPHP5框架引入的css等外部资源文件没有生效

    静态资源文件一般是放在public目录里,不只是css,只要是静态资源文件都没有显示出来. (更好的阅读体验可访问 这里 ) 问题陈述 文件结构 文件内容 三个文件分别为:Index.php.test ...

  8. css文件内引用外部资源文件的相对路径

    1.default.css文件内容(位于css文件夹下): .ClassName .ClassName .ClassName .page-sidebar .sidebar-search .submit ...

  9. wpf 加载资源文件

    方法一:App.xaml页面上写 <Application x:Class="LanguageChange.App" xmlns="http://schemas.m ...

随机推荐

  1. simulate mdns message

    use dns-sd command simulate mdns message: dns-sd -R test _test._tcp local 1234 a=1111111111111111111 ...

  2. DevExpress v17.2新版亮点—Analytics Dashboard篇(一)

    用户界面套包DevExpress v17.2日前终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了Analytics Dashboard v17.2 的新功能,快来下载试用新版本! ...

  3. sqljdbc 无法连接到主机

    今天发现sqljdbc 无法连接到SQL Server 主机.原因是SQL Server Browser 服务没有打开

  4. PostgreSQL角色和权限理解

    1.继承的权限只是继承该组的表的权限,用户对应的管理员权限则不会被继承. 2.inherit权限是说本角色是否继承别人的权限,而不是本权限能否被别的角色继承.   postgres=# create ...

  5. Apache 服务器认证 和重写

    htaccess文件是Apache服务器中的一个配置文件,它负责相关目录下的网页配置.通过htaccess文件,可以帮我们实现:网页301重定向.自定义404错误页面.改变文件扩展名.允许/阻止特定的 ...

  6. FlytestingToolkit工具派送,懒人的测试思考

    工欲善其事必先利其器,在IT路上摸爬这些年,去年我们分享了<Fiddler录制jmeter脚本,干货分享>,今天我们有另外的思考,我懒,故我思考. 下载解压后是这样的: 双击 Flytes ...

  7. Java各种排序算法

      Java各种排序算法详解 排序大的分类可以分为两种:内排序和外排序.在排序过程中,全部记录存放在内存,则称为内排序,如果排序过程中需要使用外存,则称为外排序.下面讲的排序都是属于内排序. 内排序有 ...

  8. rest_cherrypy

    一.简介 A REST API FOR SALT 二.安装,配置 yum -y install salt-api rest_cherrypy: port: # disable_ssl: True ss ...

  9. what is bitcoin

  10. MyEclipse junit测试问题initializationError

    问题的情况如上. 问题的解决方法居然是:选中函数的整行,而不是只选中函数名,如下图选中运行junit测试. TestMySQL.testDriverMannager1Unrooted Testsini ...