ToB企服应用市场:ToB评测及商务社交产业平台
标题:
4.WPF样式使用规范
[打印本页]
作者:
前进之路
时间:
2024-4-24 16:12
标题:
4.WPF样式使用规范
在Web开发的时候,编写css样式的时候通常是统一写在.css样式文件中。在WPF中也可以使用这样的思想。
样式引用:
1.新建一个项目用于统一存放样式WPF.UI
添加一个资源字典Button.xaml或者CheckBox.xaml等等....
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
2.添加Generic.xaml用于统一管理所有文件
ResourceDictionary.MergedDictionaries是一个属性,它允许您将多个ResourceDictionary合并到一个ResourceDictionary中。这使得在应用程序中共享资源变得更加方便。
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
3.在主项目中App.xaml添加引用
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
4.使用
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
图标引用:
1.创建一个文件夹用于存放图片,图片属性设置为资源
2.添加一个资源文件Icon.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
BitmapImage 表示可以在WPF应用程序中使用的图像源。它用于在各种WPF控件中显示图像,如Image、ImageBrush和MediaElement。BitmapImage可以从各种来源创建,例如文件路径、流或URI。它提供了在WPF应用程序中加载、解码和操作图像的属性和方法。
3.在Generic.xaml文件里添加引用,如上。
[/code]4.添加一个转化器
[code]/// /// 根据ICON的字符串名称转换为BitmapImage对象 /// internal class[b] IconToImageConverter[/b] : IValueConverter {<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>public object Convert(object value, Type targetType, object parameter, CultureInfo culture)<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>{<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary> return (BitmapImage)System.Windows.Application.Current.Resources[(string)value];<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>}<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>{<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary> throw new NotImplementedException();<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>} }
复制代码
5使用
//.cs代码 public override string [b]Icon[/b] => "[b]Icon_Test[/b]";//.xaml代码<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="<strong>Icon_Test</strong>" UriSource="/WPF.UI;Component/Icon/010_出差申请.png"/>
<BitmapImage x:Key="<strong>Icon_Sobel</strong>" UriSource="/WPF.UI;Component/Icon/010_打卡签到.png"/>
<BitmapImage x:Key="<strong>Icon_MedianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_发现更多.png"/>
<BitmapImage x:Key="<strong>Icon_GaussianBlur</strong>" UriSource="/WPF.UI;Component/Icon/010_费用报销.png"/>
</ResourceDictionary> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/)
Powered by Discuz! X3.4