10 2012 档案
摘要:在笔记(一)中记了点Binding的Path相关, 因为Binding的带参构造器就只有Path的参数.所以Path是很重要的, 有了Path, 即使在没有指定Source的时候, Binding也会随着UI元素树一层一层往外找DataContext对象, 判断是否具有相应的Path, 有就拿来用.一, DataContext属性与Binding笔记(一)中的Binding, 除了控件间的Binding, 其他都是在C#代码处完成的.如何在XAML中Binding那些在C#中定义的实例呢?方法之一就是使用DataContext. 1, 准备一个类public class Student{ ..
阅读全文
摘要:上次学了点点Binding的皮毛, 然后就做别的事去了, 等回头再来看WPF的时候, 哈忘记了~于是写个例子补一下, 在继续学习Binding.1, 首先准备好一个类public class Hero{ public Hero(int id, string name, string skill, bool hasM) { this.Name = name; this.Id = id; this.Skill = skill; this.HasM = hasM; } public int Id { get; set; } public string Name { ...
阅读全文
摘要:一、binding的一般步骤1,准备数据源 数据源需要实现INotifyPropertyChanged接口 例如:class Person : INotifyPropertyChanged{ public event PropertyChangedEventHandler PropertyChanged; private string name; public string Name { get { return name; } set { name = value; //触发事件 if (PropertyChanged != null)...
阅读全文
摘要:一,使用DoubleAnimation创建动画//1,创建剧本Storyboard storyboard = new Storyboard();//2,创建动画DoubleAnimation doubleAnimation = new DoubleAnimation( valueStart,//起始值 valueEnd,//终点值 new Duration(TimeSpan.FromMilliseconds(1000s))//动画时间域 );//3,TargetStoryboard.SetTarget(doubleAnimation, re...
阅读全文