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 2251 bfs
DESCRIPTION:给你一个三维的迷宫.问你是否能从起点走到终点.如果能,输出最小步数.对我来说难得就是我没有想到怎么把他给你的三维图转换成map.恩..好像解题报告上说.只要是这种的最短路都要用 ...
- 我的一起开源网 www.17ky.net上线了
.net开源生态的落后,使得.net开发人员所拥有的开源资源比其他语言的开发者少了很多,这也使得笔者很早之前就喜欢收集各种开源项目,经常会去逛codeplex,开源中国社区等网站,同时也喜欢在自己或公 ...
- 2018-2019-2 网络对抗技术 20165202 Exp5 MSF基础应用
博客目录 一.实践目标 二.实践内容 一个主动攻击实践,ms08_067(成功).ms03_026(成功且唯一); 一个针对浏览器的攻击,如ms11_050(成功)ms11_03(失败.唯一)ms10 ...
- php 文件上传处理
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAACvCAIAAADMuaTdAAAcaklEQVR4nO2da3Abx33Az3H6JdNx2i
- 《头文字D》热门同人插画欣赏
<头文字D>(INITIAL D)是一部以山道飙车为题材的日本青年漫画,以及以漫画改编的动画系列(包含电视版.OVA.与电影版).漫画作者为重野秀一(しげの秀一),自1995 年起开始在讲 ...
- Ubuntu 16.04 安装 PyCharm
https://blog.csdn.net/zhuanshu666/article/details/73554885
- HAWQ + MADlib 玩转数据挖掘之(六)——主成分分析与主成分投影
一.主成分分析(Principal Component Analysis,PCA)简介 在数据挖掘中经常会遇到多个变量的问题,而且在多数情况下,多个变量之间常常存在一定的相关性.例如,网站的" ...
- 批量解帧视频文件cpp
前言 将多个视频文件进行解帧. 实现过程 1.批量获取文件路径: 2.对某个视频文件进行解帧: 代码 /************************************************ ...
- freemarker逻辑判断写法#if
<li class="<#if (position.flag)! =='haha1'>hide<#else >show</#if>"> ...
- ES6必知必会 (五)—— Promise 对象
Promise 对象 1.Promise对象是ES6对异步编程的一种解决方案,它有以下两个特点: Promise对象代表一个异步操作,它只有三种状态:Pending(进行中).Resolved(已完成 ...