<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. PHP:第一章——PHP中的算术运算符/递增、递减运算符/赋值运算符

    算术运算符 //$a=10; $b=5; //取反: //echo -$a;//输出:-10: //加法: //echo $a+$b;//输出:15 //减法: //echo $a-$b;//输出:5 ...

  2. RK3288 GMAC整理

    一.源文件 源码路径:\drivers\net\ethernet\rockchip\gmac 源码阅读顺序: 二.重要探针函数stmmac_dvr_probe 1. alloc_etherdev 申请 ...

  3. Awk 从入门到放弃 (7) 动作总结之二

    第一题: 使用if语句进行判断

  4. 14 printf输出格式及栈空间分配

    假设在一个32位的 little endian的机器上运行下面程序,输出结果:1 0 2 #include<stdio.h> int main() { ,b=,c=; printf(&qu ...

  5. kettle使用命令行来运行ktr和kjb

    1:cmd方式运行 1.ktr的运行:运行transformation文件是通过Pan.bat来运行的. 打开cmd命令行窗口,转到Pan.bat所在的目录,如d:\data-integration, ...

  6. css rem计算

    先抛出一个问题:为什么要选择rem? px:像素是相对于显示器屏幕分辨率而言的相对长度单位.pc端使用px倒也无所谓,可是在移动端,因为手机分辨率种类颇多,不可能一个个去适配,这时px就显得非常无力, ...

  7. apache2.4搭建php5.53问题总结

    1.如果Apache handler方式配置php,则最好选择Thread Safe,否则找不到php5apache2_4.dll.如果选择VC6版本以上的php,请到这里http://www.apa ...

  8. Python3 文件操作(十六)

    一 文件操作 1.介绍 计算机系统分为:计算机硬件,操作系统,应用程序三部分. 我们用python或其他语言编写的应用程序若想要把数据永久保存下来,必须要保存于硬盘中,这就涉及到应用程序要操作硬件,众 ...

  9. DevExpress使用教程:XtraGridControl动态添加右键菜单

    在使用 GridControl 的时候经常需要添加右键菜单.一般的做法是自己创建菜单项,然后注册GridView的Mouse-Click事件,然后Show出定义好的菜单.但是涉及到一些单击事件会收到编 ...

  10. vue2.0分页组件,

    pagination.vue <!-- 表格分页组件 --> <template> <nav class="boot-nav"> <ul ...