wpf Binding 小记录

1、后台属性绑定:

Grid g = new Grid() { Width = 60, Height = 100 };
g.SetValue(Panel.ZIndexProperty, 10);
//Canvas.SetBottom 绑定数据MLength
Binding bind = new Binding("MLength") { Source = this,Mode= BindingMode.TwoWay};
g.SetBinding(Canvas.BottomProperty,bind);

注:MLength为依赖性属性

2、xaml绑定时间(格式)

Text="{Binding JionTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}

注:JionTime为DataTime类型

上一篇:数组Array和列表集合ArrayList、LinkedList和Vector的区别


下一篇:关于require,require_once,include和include_once的区别