<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. adb命令(笔记)

    1.adb shell su   进入root管理员权限(前提是手机已root) 2.chmod 可以修改文件夹的权限: $ adb shell $ su # chmod -R 777  /data/ ...

  2. delete symlink in subversion using svn delete command

    # svn delete etc/systemd/system/getty.target.wants/serial-getty@ttyS3.service@ D         etc/systemd ...

  3. bug 问题

    1. 图片 img 标签,在IE浏览器下会有空白 - 解决办法:display:block; 2. IE6 下父级没有宽高,不会触发haslayout. 触发原因:子级浮动,父级没有宽高,overfl ...

  4. Python Face Recognition 实现人脸识别

    一.Face Recognition软件包 我们的人脸识别基于face_recognition库.face_recognition基于dlib实现,用深度学习训练数据,模型准确率高达99.38%. 人 ...

  5. 编译EXE文件的时候pcap编译不进去。 pyinstaller pcap pypcap 报错

    如果生成的exe源码中有import pcap 那么你目标机上就要先装npcap 并勾选winpcap API. 然后就不出这个问题了. 暂时的办法是第一个exe不包含import pcap.自检np ...

  6. Jena解析rdf、nt、ttl格式数据

    比如有一个ttl格式的文件名为cco.ttl package com.jena; import java.io.InputStream; import com.hp.hpl.jena.rdf.mode ...

  7. Java——IO类,字符流读数据

    body, table{font-family: 微软雅黑} table{border-collapse: collapse; border: solid gray; border-width: 2p ...

  8. DevExpress WPF入门指南:绑定编辑器对话框

    绑定编辑器对话框 每个Smart Tag属性既可以设置也可以绑定.如下图所示,点击绑定按钮打开绑定对话框: 如果属性已经绑定,binging按钮会显示为黄色,绑定的文本会显示在相应的属性行. 绑定So ...

  9. apache ab工具安装测试

    1.安装 安装包下载地址: 将 httpd-2.2.29.tar.gz 解压到目录 /apps/install/httpd-2.2.29 ,这是我放置的位置 cd /apps/install/http ...

  10. 互评Beta版本

    作业要求[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2448] 基于NABCD评论作品,及改进建议 1.杨老师粉丝群.作品:<P ...