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

2011年5月17日

摘要: 关于在VS2008新建WPF类库时,有Custom Control和User Control两个选择。User Control类库会在工程中建立一个XAML文件及其绑定后台代码,前者以<UserControl开头,后者是一个派生自UserControl的类。Custom Control类库则在工程中创建派生自Control基类的CustomControl1控件,并在构造函数中为CustomControl1指定依赖属性DefaultStyleKeyProperty:Custom Control类库还会在Theme目录下生成Generic.xaml,这是一个以<ResourceDict 阅读全文

posted @ 2011-05-17 23:54 linFen 阅读(6563) 评论(2) 推荐(2) 编辑

摘要: 1.MVVM设计模式简介 MVVM的设计模式最早于2005年由微软的WPF和Silverlight架构师John Gossman在他的博客中提到。以下是这篇文章的链接: http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx MVVM设计模式基于MVC这种将UI和逻辑分离的结构思想。传统的.NET平台下软件开发如ASP.NET和WPF/Silverlight大多数是基于CodeBehind这样的方式,我们往往将所有的代码全部写在后台代码文件中,例如UI操作,业务逻辑操作,IO,数据服务的调用等等。这虽然表面上有利于“ 阅读全文

posted @ 2011-05-17 23:45 linFen 阅读(604) 评论(0) 推荐(1) 编辑

摘要: 1.WPF样式类似于Web应用程序中的CSS,在WPF中可以为控件定义统一的样式(Style)。样式属于资源的一种,例如为Button定义统一的背景颜色和字体:<Window.Resources><Style TargetType="Button"><Setter Property="Background" Value="Yellow" /></Style></Window.Resources><StackPanel><Button>Button A& 阅读全文

posted @ 2011-05-17 21:29 linFen 阅读(2828) 评论(0) 推荐(1) 编辑

摘要: delegateCommand.cs://-----------------------------------------------------------------------//<copyrightfile="DelegateCommand.cs"company="DigitalChina">//Copyright(c)DigitalChina.Allrightsreserved.//</copyright>//<author>LiangLan</author>//<date>2011 阅读全文

posted @ 2011-05-17 21:00 linFen 阅读(1274) 评论(0) 推荐(1) 编辑