心如止水

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2008年11月4日

摘要: 这是msdn上用WPF实现的一个时钟的程序。 下载 阅读全文
posted @ 2008-11-04 17:46 cutebear 阅读(920) 评论(0) 推荐(0) 编辑

2008年11月3日

摘要: IFormatProvider接口 首先介绍String.Format(IFormatProvider, string format, Object[] args)方法,其中args参数指定待format的参数列表。format参数指定格式,format参数的语法格式如下: {index[,alignment][:formatString]} Index是从0开始的int数,对应args列表... 阅读全文
posted @ 2008-11-03 16:15 cutebear 阅读(13609) 评论(5) 推荐(0) 编辑

2008年10月29日

摘要: 原文地址:http://www.sellsbrothers.com/tools/#ShowMeTheTemplate。 这是别人写的一个小工具,通过它我们可以查看到WPF中的一些控件的内部定义的Template,并且内嵌了六种WPF中的Theme,通过选择不同的Theme,我们会发现控件的Template在不同的Theme下有些什么不同。 个人感觉这个工具非常的强大,而且实现过程也很值得学习。 下载2011-09-08 下面是自己写的一个例子:http://files.cnblogs.com/bear831204/GetStyleAndTemplate.zip附加一个类似的例子,为visual 阅读全文
posted @ 2008-10-29 17:31 cutebear 阅读(514) 评论(1) 推荐(0) 编辑

2008年10月24日

摘要: 今天看见一篇文章,讲的是用WPF实现的一个放大镜程序,可以用来察看图片。主要用到的是VisualBrush, 这个放大镜是一个Ellipse,大概原理如下: VisualBrush vb = new VisualBrush(); vb.Visual = 图片; magnifierEllipse.Fill = vb; 这样设置以后原来的图片就会自动的按比例缩小或放大,来填充magnifie... 阅读全文
posted @ 2008-10-24 17:03 cutebear 阅读(4765) 评论(2) 推荐(0) 编辑

摘要: 最近读了WPFUnleashed这本书的第三章,主要介绍了一下几个方面:1. Logical and Visual Trees(逻辑树和视觉树)2. Dependency Properties(依赖属性)3. Routed Events4. Commands5. WPF 类的层次概述下面分别是我觉得比较重要的地方的笔记。1. 逻辑树和视觉树逻辑树就是我们实际看到的节点间的树的结构。视觉树可以看作... 阅读全文
posted @ 2008-10-24 10:00 cutebear 阅读(382) 评论(1) 推荐(0) 编辑

2008年10月23日

摘要: 原文地址:http://www.cnblogs.com/dudu/archive/2008/10/23/931748.html#1349483 支持文章与图片的发布。设置步骤: 选择左上角的按钮,选择发布>博客。 在博客服务商中选择"其他"。 在API中选择MetaWeblog。 在博客文章URL中博客园的MetaWeblog访问地址,格式为:http://www.cnblog... 阅读全文
posted @ 2008-10-23 17:50 cutebear 阅读(204) 评论(0) 推荐(0) 编辑

2008年10月20日

摘要: 原文:http://www.beacosta.com/blog/?p=9 What is the difference between SelectedValue and SelectedItem? When they are used by themselves, these two properties are very similar. The need for both and the d... 阅读全文
posted @ 2008-10-20 15:52 cutebear 阅读(1761) 评论(0) 推荐(0) 编辑

摘要: 1. What is DataBinding? 数据绑定是在UI和业务逻辑间建立一个连接的过程,如果绑定有被正确的设置以及数据提供了合适的通知机制,则当数据改变时,被绑定这个数据的元素会自动的反应这个变化。2. Basic Data Binding Concepts 无论你用何种绑定target和绑定source,所有的绑定都遵循下面的绑定关系:这个特性说明了以下几点... 阅读全文
posted @ 2008-10-20 15:44 cutebear 阅读(1392) 评论(1) 推荐(0) 编辑

摘要: 1. RelativeSource用来指定一个相对的source位置,通常有以下三种方式:(1): RelativeSource.Self 允许把自己当作相对的元素。(2): RelativeSource.FindAncestor 根据指定的类型(AncestorType)和向上寻找的层次(AncestorLevel)向祖先寻找。例如AncestorLevel设为1,则把第一次找到的匹配的object作为参照对象,如果为2,则把第二次匹配的object作为参照对象。<StackPanel Background="Blue"><TextBlock Backg 阅读全文
posted @ 2008-10-20 15:37 cutebear 阅读(696) 评论(0) 推荐(0) 编辑

摘要: 下面这个例子介绍了如何利用.net remoting 来实现App Domain间的访问,而且通过创建一个新的App Domain来加载一些untrusted的dlls,保证了程序自身的App Domain的边界安全。下载下面是程序的main函数:namespace Microsoft.Samples.Application{ static class Program { ... 阅读全文
posted @ 2008-10-20 15:31 cutebear 阅读(411) 评论(0) 推荐(0) 编辑

2008年10月17日

摘要: 例如DataTemplate如下: 在ListBoxItem中应用它: 这里IsSynchronizedWithCurrentItem="True"保证SelectedItem就是CurrentItem。如果要找到DataTemplate为具体的某一个ListBoxItem生成的TextBlock元素,就先要找到这个ListBoxItem里面的Con... 阅读全文
posted @ 2008-10-17 13:34 cutebear 阅读(1342) 评论(3) 推荐(0) 编辑

摘要: 对本例的一些说明,例如下面的一个例子,首先是一个记载数据信息的类,namespace WpfApplication33{ public class GreekGod { private string name; public string Name { get { return name; } set... 阅读全文
posted @ 2008-10-17 11:56 cutebear 阅读(576) 评论(0) 推荐(1) 编辑

2008年10月16日

摘要: 本文讲述了在一个ItemsControl内部,ListView内部,以及两者之间互相拖动item的实现。涉及到了DataTemplate、Style、Adorner、ContentPresenter、VisualTreeHelper、AttachedProperty等知识,个人认为非常的好。原文地址:http://www.beacosta.com/blog/?m=200802,下面是原文: B... 阅读全文
posted @ 2008-10-16 17:31 cutebear 阅读(1177) 评论(0) 推荐(2) 编辑

2008年10月14日

摘要: 除了将单个不同类型的数据转换类型,使它与target的数据类型匹配外,有时我们需要muti binding,它可以将一个target property绑定source object的多个不同属性,然后通过实现IMultiValueConverter接口,根据不同的逻辑来决定target property要显示什么。如下,首先有一个Data object类:public class MyData ... 阅读全文
posted @ 2008-10-14 15:15 cutebear 阅读(603) 评论(0) 推荐(0) 编辑

2008年10月13日

摘要: LinearGradientBrush指的是一个线性的坡度类,用它和GradientStop类可以为一个矩形区域填充渐变的颜色。例如:<!-- This rectangle is painted with a diagonal linear gradient. --> <Rectangle Width="200" Height="100"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1&quo 阅读全文
posted @ 2008-10-13 17:20 cutebear 阅读(1406) 评论(1) 推荐(2) 编辑