• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






iwteih

淡泊以修身,宁静以养性
 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  WPF

1 2 下一页

 
How to customize an ItemsControl
摘要:How to customize an ItemsControlContentsHow to customize an ItemsControlIntroductionWhen you don’t need to customize anything at allThe inner workings of an ItemsControlThe ItemsControl itselfThe Item ContainerThe Items HostCustomizing the Item ContainerCustomizing the Items HostWhen you need to wri 阅读全文
posted @ 2012-04-10 23:53 iwteih 阅读(752) 评论(0) 推荐(0)
Writing More Efficient ItemsControls
摘要:http://msdn.microsoft.com/en-us/magazine/dd483292.aspxCharles PetzoldCode download available from the MSDN Code GalleryBrowse the Code Online ContentsAn ItemsControl Scatter PlotThe Performance DisappointmentHidden LoopsUsing Value Conve... 阅读全文
posted @ 2012-04-10 23:48 iwteih 阅读(338) 评论(0) 推荐(0)
Trying out Binding.StringFormat
摘要:stringFormat is a new property in .Net 3.5 SP1, which is currently in Beta.SeeScott’s blogfor more info on the beta.When you bind data into a property on an element, it’s automatically type converted for you.For example, this markup:<StackPanelxmlns:sys="clr-namespace:System;assembly=mscorli 阅读全文
posted @ 2012-03-29 18:04 iwteih 阅读(495) 评论(0) 推荐(0)
WPF 自定义快捷键命令(Command)(转)
摘要:命令简介 WPF 中的命令是通过实现 ICommand 接口创建的。ICommand 公开两个方法(Execute 及 CanExecute)和一个事件(CanExecuteChanged)。Execute 执行与命令关联的操作。CanExecute 确定是否可以在当前命令目标上执行命令。如果集中管理命令操作的命令管理器检测到命令源中发生了更改,此更改可能使得已引发但尚未由命令绑定执行的命令无效... 阅读全文
posted @ 2010-11-25 15:50 iwteih 阅读(584) 评论(0) 推荐(0)
Debugging Data Binding in WPF
摘要:原贴:http://jimmangaly.blogspot.com/2009/04/debugging-data-binding-in-wpf.htmlWhat do you do when you suspect that a data binding is broken in your WPF application? Looking at the Output window for data... 阅读全文
posted @ 2010-04-14 13:12 iwteih 阅读(401) 评论(0) 推荐(1)
TemplatePartAttribute
摘要:在学习ControlTemplate示例时,发现有一些template中元素名称以PART_开头,在《Windows Presentation Foundation Unleashed》中也提到了。 在WPF自带的templdate中有很多以PART_开头的元素,这些元素都是用TemplatePartAttribute标记过,表示如果用户想自定义模版,必须提供同名及同类型的元素。原因是WPF自带的... 阅读全文
posted @ 2010-03-12 15:54 iwteih 阅读(1003) 评论(0) 推荐(1)
Trigger
摘要:FrameowrkElement, Style, DataTemplate和ControlTemplate都有一个Triggers集合。 Trigger分三类: ► Property trigger: dependency property改变时触发。对应的Trigger类。比较Property和Value的值,如果相同,则触发,如不同不触发或撤消更改。常见的例子是用bool值作触发条件,但是请记... 阅读全文
posted @ 2010-03-02 14:10 iwteih 阅读(1203) 评论(0) 推荐(0)
[译]关于Data Binding,我不知道的10件事
摘要:http://dotnet.org.za/rudi/archive/2008/03/25/10-things-i-didn-t-know-about-wpf-data-binding.aspx我的n层wpf项目中使用了大量的binding,现在我把我了解到的WPF中一些不太为人注意的地方贴出来。1) Binding path "(TextBox.Text)" vs "Text"?如果Path叫Te... 阅读全文
posted @ 2010-02-23 17:59 iwteih 阅读(1054) 评论(0) 推荐(0)
Binding 使用多个源
摘要:以下三个都是与多源组合相关。 CompositeCollection MSDN上的说明:启用要以单个列表形式显示的多个集合和项。可以解理为把多个源组合在一起,然后以列表形式显示。<Window Background="Cornsilk" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="h... 阅读全文
posted @ 2010-02-22 15:12 iwteih 阅读(853) 评论(0) 推荐(0)
WPF3.5 使用BindingGroup进行实体类和集合验证
摘要:前文介绍了自定义或系统自带的ValidationRule进行验证,这种方法对于单个元素的验证不错。很多时候,我们需要对表单(Form)进行验证,也就是对一个实体类进行验证,或者对一个集合的每项进行验证,则显得不尽人意(每次只能验证一次)。WPF3.5中提供了BindingGroup用来验证多个绑定元素,可以对表单(form)和实体类进行验证。另外BindingGroup提供了Transcation... 阅读全文
posted @ 2010-02-21 11:40 iwteih 阅读(5004) 评论(1) 推荐(1)
WPF中Binding的验证
摘要:使用 WPF 数据绑定模型可以将 ValidationRules 与 Binding 对象相关联。验证在从绑定目标到绑定源的值传输过程中调用转换器之前发生。下面描述了验证过程: 在将值从目标属性传输到源属性时,数据绑定引擎首先移除可能已添加到所绑定元素的 Validation.Errors 附加属性的任何 ValidationError。然后,数据绑定引擎检查是否为该 Binding 定义了自定义... 阅读全文
posted @ 2010-02-13 16:39 iwteih 阅读(3611) 评论(0) 推荐(1)
Data Provider
摘要:WPF绑定中提供两种provider:XmlDataProvider和ObjectDataProviderXmlDataProvider 可以把Xml数据放在单独的文件中:<XmlDataProvider x:Key=”dataProvider” XPath=”GameStats” Source=”GameStats.xmlR... 阅读全文
posted @ 2010-02-09 14:25 iwteih 阅读(440) 评论(0) 推荐(0)
WPF中的视图
摘要:当绑定源是集合时,WPF实际用的是CollectionView进行绑定。集合视图是位于绑定源集合顶部的一层,您可以通过它使用排序、筛选和分组查询来导航和显示源集合,而无需更改基础源集合本身。集合视图还维护着一个指向集合中的当前项的指针。如果源集合实现了INotifyCollectionChanged接口,则CollectionChanged 事件引发的更改将传播到视图。 在代码中可以通过Colle... 阅读全文
posted @ 2010-02-09 11:27 iwteih 阅读(1409) 评论(0) 推荐(0)
WPF Binding
摘要:WPF里分三种Binding:Binding, PriorityBinding, MultiBinding,这三种Binding的基类都是BindingBase,而BindingBase又继承于MarkupExtensionBinding提供对绑定定义的高级别访问,绑定将绑定目标对象(通常为 WPF 元素)的属性与任何数据源(例如数据库、XML 文件或包含数据的任何对象)连接起来。 常见的使用Bi... 阅读全文
posted @ 2010-02-03 18:05 iwteih 阅读(23297) 评论(9) 推荐(7)
WPF的资源续集
摘要:1. 两种资源文件的连接 前面讲了.net中使用资源的通用方法,以及WPF中对UI进行Localization的方法,在实际使用中,经常会同时使用两种方法,我们需要用al.exe这个工具,把两个资源文件链接成一个资源文件:al /template:WpfLocalizationLocBaml.exe /embed:de\WpfLocalizationLocBaml.g.de.resources ... 阅读全文
posted @ 2010-01-28 16:06 iwteih 阅读(1289) 评论(0) 推荐(0)
利用LocBaml进行Localization
摘要:开发WinForm程序时,可以在设计界面上选中Form后,在属性中设置Localizable和Language设置不同区域时,控件界面的显示,如图: 在Build时,bin文件夹中会生成一个zh-CN的文件夹,里面是编译好的二进制资源文件。这么方便的功能WPF中竟然没有,不过Microsoft提供了LocBaml这个工具,目前这个工具可以通过微软的网页上下载到。利用LocBaml和MsBuild可... 阅读全文
posted @ 2010-01-19 17:36 iwteih 阅读(1976) 评论(0) 推荐(1)
资源与本地化
摘要:下载本文的代码: BasicInstincts05.exe (146KB) 本页内容 嵌入资源 资源文件 使用资源文件 Visual Studio 2005 中的资源文件 项目级资源文件 区域设置与本地化 附属程序集 加载本地化资源 本地化窗体和控件设置 小结可通过两种方法使用基于 Microsoft® .NET Framework 应用程序中的资源,如字符串、图像和基于文本的文件。可以... 阅读全文
posted @ 2010-01-18 13:31 iwteih 阅读(1328) 评论(0) 推荐(0)
Resource URI
摘要:后两对可以访问到其他assembly的资源. MyDll;Component/logo.jpg中的Component是保留字,有4种格式用来确定MyDll: site of origin: 有四种情况: 阅读全文
posted @ 2010-01-18 13:28 iwteih 阅读(197) 评论(0) 推荐(0)
WPF 自带控件札记
摘要:Content controls 判断Content control是否有content: 使用HasContent属性 增加此属性,而不直接使用Content == null 的原因是方便在xaml做出判断,比如可以根据HasContent增加Trigger Content Control的呈现: 调用UIElement的OnRender方法,如果content没此方法,会调用ToStri... 阅读全文
posted @ 2010-01-18 11:37 iwteih 阅读(754) 评论(0) 推荐(0)
Click a button programmatically
摘要:ButtonAutomationPeer bap = new ButtonAutomationPeer(myButton);IInvokeProvider iip = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider;iip.Invoke(); // This clicks the ButtonButtonAutomationPe... 阅读全文
posted @ 2010-01-18 11:31 iwteih 阅读(781) 评论(0) 推荐(0)
 

1 2 下一页