【发布时间】:2011-01-03 02:32:06
【问题描述】:
我是 WPF 的新手,并试图围绕 WPF 的框架,它为您做什么和不做什么。
为了澄清这一点,我想知道这之间有什么区别:
public List<MyCustomObject> MyCustomObjects
{
get { return (List<MyCustomObject>)GetValue(MyCustomObjectsProperty); }
set { SetValue(MyCustomObjectsProperty, value); }
}
public static readonly DependencyProperty MyCustomObjectsProperty =
DependencyProperty.Register("MyCustomObjects", typeof(List<MyCustomObject>),
typeof(Main), new UIPropertyMetadata(new List<MyCustomObject>()));
还有这个:
public ObservableCollection<MyCustomObject> MyCustomObjects { get; set; }
public Main ()
{
MyCustomObjects = new ObservableCollection<<MyCustomObject>();
}
【问题讨论】:
-
感谢大家的回答。 Cwap 似乎对我来说最清楚,所以我和他一起去了,但我都投了赞成票。再次感谢!
标签: wpf data-binding binding collections