WPF Demo9外部资源文件

<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外部资源文件的更多相关文章
- ArcGIS for WPF 访问外部资源【进阶之构造URL】
原文 http://www.cnblogs.com/wdysunflower/archive/2013/05/29/3039645.html 呵呵~好久没逛园子,没写博客了. 最近刚好又在弄GIS这块 ...
- ArcGIS for WPF 访问外部资源
原文 http://www.cnblogs.com/wdysunflower/archive/2011/07/14/2105584.html ArcGIS for WPF 访问外部资源 应用背景: 因 ...
- 总结:WPF中ResourceDictionary资源文件的查找和遍历方法
原文:总结:WPF中ResourceDictionary资源文件的查找和遍历方法 一.查找包含制定关键字的资源 ResourceDictionary GetThemeDictionary() ...
- spark-submit --files 动态加载外部资源文件
在做spark时,有些时候需要加载资源文件,需要在driver或者worker端访问.在client模式下可以使用IO流直接读取,但是在cluster模式下却不能直接读取,需要如下代码: val is ...
- Spark动态加载外部资源文件
Spark动态加载外部资源文件 1.spark-submit --files 动态加载外部资源文件 之前做一个关于Spark的项目时,因项目中需要读取某个静态资源文件,然后在本地IDEA测试一切皆正常 ...
- wpf 前台获取资源文件路径问题
1 <ImageBrush ImageSource="YT.CM.CommonUI;component/Resource/FloadwindowImage/middle.png&quo ...
- ThinkPHP5框架引入的css等外部资源文件没有生效
静态资源文件一般是放在public目录里,不只是css,只要是静态资源文件都没有显示出来. (更好的阅读体验可访问 这里 ) 问题陈述 文件结构 文件内容 三个文件分别为:Index.php.test ...
- css文件内引用外部资源文件的相对路径
1.default.css文件内容(位于css文件夹下): .ClassName .ClassName .ClassName .page-sidebar .sidebar-search .submit ...
- wpf 加载资源文件
方法一:App.xaml页面上写 <Application x:Class="LanguageChange.App" xmlns="http://schemas.m ...
随机推荐
- POJ 1847 dijstra算法
POJ 无限循环CE中.感觉是读题难.然后就可以建图上模板了. 附个人代码: #include<stdio.h>#include<string.h>#include<io ...
- httpclient httpclient使用连接池
httpclient使用连接池 http协议是无状态的,但毕竟是基于tcp的,底层还是需要和服务器连接的, 对于需要从同一个站点抓取大量网页的程序,应该使用连接池,否则每次抓取都和web站点建立连接, ...
- php抓取文章内容分析
preg_match_all — 执行一个全局正则表达式匹配 int preg_match_all ( string pattern, string subject, array matches [, ...
- ThinkPHP CodeIgniter URL访问举例
ThinkPHP URL访问: http://localhost/think/index.php/Home/login/func/[name/syt/password/123/] ht ...
- 基于Eclipse的Android开发环境搭建
1. Java开发环境搭建 1.1 JDK下载安装 JDK(Java Development Kit )是针对Java开发人员发布的软件开发工具包.JDK 是整个Java的核心,包括了Java运行 ...
- spring jdbc配置文件进行加密解密
最近做一个项目,安全上有点要求,就是要对数据库相关的配置进行加密,配置文件如下: #加密前#datasource.type=mysql #datasource.driverClassName=com. ...
- 【leetcode】2-AddTwoNums
problem: Add Two Numbers 需要学习的是单向链表的基础使用:
- 查看linux安装包的版本信息-TX2
前言 新到手一块TX2板子,想要检查系统是否安装某软件及其版本. 操作命令 Cuda8.:nvcc --version Opencv:pkg-config --modversion opencv G+ ...
- VS2015 Release 生成调试信息
- C/C++ > 常规 > 调试信息格式 - C/C++ > 优化 > 优化 > 禁止(/Od) - 链接器 > 调试 > 生成调试信息 > 是 (/ ...
- 20155301 2016-2017-2 《Java程序设计》第9周学习总结
20155301 2016-2017-2 <Java程序设计>第9周学习总结 教材学习内容总结 JDBC全名Java DataBase Connectivity,是联机数据库的标准规范.具 ...