摘要: Convert在WPF页面显示中,使用比较多。今天就来瞎想下Convert1.先来个最常用的 bool 转 VisibleXAML代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:WpfApplication4" xmlns:x="http://schemas.microsoft.com/w 阅读全文
posted @ 2013-02-15 21:05 qiurideyun 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 动态控件添加,基本UI开发都需要使用。我看过很多人写,都停留在WinFrom开发时代的直接操作控件来实现动态添加控件。到了WPF依然很多人在这样操作。(不是说这样写错误,但是这违背了UI和逻辑分离的思想,不利于后期维护。深有体会。当看到后台密密麻麻的添加子控件,心情瞬间崩溃)我们先来看下UI和逻辑不分离的代码(简单粗暴实现代码):XAML代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation 阅读全文
posted @ 2013-02-15 15:56 qiurideyun 阅读(736) 评论(0) 推荐(0) 编辑
摘要: DataTemplate可以说是WPF的灵魂之一。可以灵活的定制样式和动态添加控件。今天先来了解DataTemplate通常使用(DataGrid的DataTemplate)(代码中有些方法,你可以参考之前的blog)XAML的代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:WpfApplication4&q 阅读全文
posted @ 2013-02-15 15:09 qiurideyun 阅读(548) 评论(0) 推荐(0) 编辑
摘要: 之前的NotifyObjec有问题。是多个属性同时对一个Object进行操作。新代码如下。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.ComponentModel;using System.Linq.Expressions;namespace WpfApplication4{ public abstract class NotifyObject:INotifyPropertyChange... 阅读全文
posted @ 2013-02-15 14:25 qiurideyun 阅读(1341) 评论(0) 推荐(1) 编辑