- 博客(30)
- 资源 (19)
- 收藏
- 关注
原创 WPF给图片加水印
public class WatermarkHelper { string _waterImgPath; BitmapSource _waterPic; string _prefix = null; // constructors public WatermarkHelper(string waterImgF
2013-10-11 21:57:58
2709
原创 WPF 多国语言 localization
因为项目是多国语言的,所以用到了wpf的多国语言相关知识,其实也比较简单,分享给大家,自己也做个备忘。基本步骤如下:1.让界面上所有能够出现的label都使用动态资源(DynamicResource)这样我们在切换语言的时候程序界面上的字符才会自动切换,这里我们举个简单的TextBlock的例子,原本也许你会直接写但是如果需要国际化,那么你需要这样写把原本har
2013-10-08 20:49:16
4390
原创 .Net 小技巧——XmlElement 与 XElement互相转换
XmlElement LinqToXmlElement(XElement xElement) { if (xElement == null) return null; XmlElement xmlElement = null; XmlReader xmlReader = null; t
2013-01-05 10:24:36
3735
1
原创 WPF 数据绑定
WPF中的数据绑定非常的灵活,使用起来也是十分的简单,这里我不扯什么理论知识了发个链接 想仔细研究的同学 可以自己去慢慢看MSDN http://msdn.microsoft.com/zh-cn/library/ms752347(v=vs.100).aspx本文主要是针对那些个想迅速了解数据绑定 直接上手的同学所写,废话不多说 上代码<Window x:Class="Dat
2012-10-19 11:36:07
4575
原创 WPF 列表控件隔行变色
不知道大家在做wpf项目的过程中有没有碰到过需要列表或者表格显示的时候隔行变色的需求 如下图以往做web的时候还是比较容易实现的 给个table写个style就行了下面介绍下在wpf中如何实现以上效果废话不多说 直接上代码前台代码:<Window x:Class="AlternateColor.MainWindow" xmlns="http:
2012-10-18 10:02:38
8772
原创 WPF TreeGrid(树形展开的表格)
一直都想要个树形展开的表格 像这样的今天心血来潮就简单做了个TreeGrid 喜欢的同学可以下载下去自己研究下,其实也比较简单主要就是TreeView TreeViewItem再配合GridViewHeaderRowPresenter、GridViewRowPresenter、GridViewColumnCollection定制style基本上就可以实现以上效果本文中涉及大
2012-10-11 17:03:07
24667
1
原创 WPF触发器(Trigger、DataTrigger、EventTrigger)
WPF中有种叫做触发器的东西(记住不是数据库的trigger哦)。它的主要作用是根据trigger的不同条件来自动更改外观属性,或者执行动画等操作。WPFtrigger的主要类型有:Trigger、MultiTrigger、DataTrigger、MultiDataTrigger、EventTrigger几种。从字面意思上我们想大家已经知道个大概,接下来我将还会用实例代码逐一进行介绍。trig
2012-09-28 18:09:55
48813
3
原创 WPF中的图片文件、byte[]、BitmapImage的操作
public MainWindow() { InitializeComponent(); byte[] b = GetPictureData(@"F:\WPF\TestSolution\TestReatByteFromDB\Images\123.png"); BitmapImage myimg = ByteAr
2012-09-27 09:48:24
12496
转载 .NET文件操作类 (转载)
using System; using System.Collections.Generic; using System.Text; using System.IO; #endregion namespace CommonUtilities { /// /// 文件操作类 /// public class FileHelper {
2012-09-26 17:27:55
1489
原创 WPF线程模型
大家可能会有这样的经历,在做UI开发的时候,遇到一些比较耗时的操作,界面会被卡住(阻塞),用户没有办法操作界面,从而给用户体验打了一个大大的折扣。这样的操作大部分是在取大量数据,或者是在一些文件存取等费时的操作上。那么怎么解决这个问题呢,这个时候就需要使用多线程的编程技术,将UI线程从复杂的任务中解放出来,从而使用户获得更好的用户体验。首先我们必须了解一些基本的概念:在WPF的应用程序中有
2012-09-25 18:51:15
3523
原创 WPF拖拽
写一个比较简单的拖拽实例给那些和我一样正在学习wpf的菜鸟们,代码比较粗糙,注意精华部分就行了 其他的可以自动忽略。前台一个itemscontrol空间 里面绑定了一排列表,随便拖动一个到右边的框里,会显示拖动的项目的文字,只是阐述原理,其他的你还可以做很多额外的东东,自己发挥吧。<Window x:Class="TestPro.MainWindow" xmlns="htt
2012-09-24 11:58:54
3553
原创 WPF loading遮罩层 LoadingMask
大家可能很纠结在异步query数据的时候想在wpf程序中显示一个loading的遮罩吧今天就为大家介绍下遮罩的制作源码下载 点击此处先上张效果图看看 如果不如您的法眼 可以移步了 或者有更好的效果 可以留言给我 废话不多说 直接贴代码 一个usercontrol<UserControl x:Class="LoadingMask_Demo.Loadin
2012-09-23 11:29:59
23678
12
原创 WPF中模板(ControlTemplate and DataTemplate)
WPF中的模板是一个特别重要的概念,对于做UI开发的同学来说熟悉ControlTemplate(控件模板) 和DataTemplate(数据模板)是必须掌握的技能,否则就只能做个拖控件的菜鸟。下面就着重介绍下这两类模板的概念和使用。1.ControlTemplate 就是我们常说的控件模板,主要用途是更改控件的外观,比如你要修改一个Button的形状是圆形的,改变背景颜色,定制动画效果等等
2012-09-21 13:58:27
9425
原创 有了它wpf的style可以任你发挥了
前段时间一直在做wpf的UI开发,每次想做些控件style定制的时候都很头疼很多控件不知道他的controltemplate是什么样的为了方便大家写style 特别奉上wpf的style大全从此,妈妈再也不用担心我的wpf,哪里不会点哪里,so easy!下载地址wpf controltemplate demoShared in all filewindow
2012-09-20 11:01:50
12133
原创 ControlTemplate in WPF —— DataGrid
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="{x:Type B
2012-09-20 11:01:39
3197
原创 ControlTemplate in WPF —— Calendar
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch
2012-09-20 11:00:52
3814
原创 ControlTemplate in WPF —— Shared in all file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">--> <Style x:Key="VerticalHIC"
2012-09-20 11:00:19
2113
原创 ControlTemplate in WPF ——ScrollBar
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> --> --> <Style x:Ke
2012-09-20 10:58:27
1223
原创 ControlTemplate in WPF —— Menu
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch
2012-09-20 10:57:38
2568
原创 ControlTemplate in WPF —— Expander
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:
2012-09-20 10:56:56
2006
原创 ControlTemplate in WPF —— Window
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> --> <Style x:Key="
2012-09-20 10:55:13
2283
原创 ControlTemplate in WPF —— DatePicker
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!--In this example, an implecit st
2012-09-20 10:54:01
3306
原创 ControlTemplate in WPF —— TabControl
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch
2012-09-20 10:53:14
2555
原创 ControlTemplate in WPF —— TreeView
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> --> <Style x:Key="{x:
2012-09-20 10:52:44
2598
原创 ControlTemplate in WPF —— ItemsControl
<ItemsControl Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}"> <!--The ItemsControl has no default visual appearance. Use the Template property to specify
2012-09-20 10:52:07
1762
原创 ControlTemplate in WPF —— ListBox
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> --> <Style x:Key="{x:
2012-09-20 10:51:05
2293
原创 ControlTemplate in WPF —— ComboBox
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch
2012-09-20 10:49:54
5193
原创 ControlTemplate in WPF —— TextBox
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> --> --> <Sette
2012-09-20 10:48:34
1969
原创 ControlTemplate in WPF —— RadioButton
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> -->
2012-09-20 10:46:56
1598
原创 ControlTemplate in WPF —— Checkbox
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://sch
2012-09-20 10:45:14
1461
WPF 多国语言 localization
2013-10-08
LoadingMask(WPF加载数据loading遮罩)
2012-09-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人