【发布时间】:2011-01-19 21:07:26
【问题描述】:
我正在尝试设计一个由 TextEditor 和 PopUp 组成的 CustomUserControl...
所以 Popup 控件应该绑定到一个列表... 我称它为BindingList。此属性应接受任何类型,例如 ObservableCollection、List、Ienumerable,例如(Collections)...
<my:CustomControl BindingList="{Binding Path=Collection}"
public IEnumerable<object> BindingList
{
get { return (IEnumerable<object>)GetValue(BindingListProp); }
set { SetValue(BindingListProp, value); }
}
BindinglistProp
public static readonly DependencyProperty BindingListProp = DependencyProperty.Register(??????
我不知道它应该如何接受绑定。
我应该如何处理通过的集合?当它是我不知道的类型时
喜欢
class Person
{
private string _Name;
private string _forename;
public string Name
{
get { return _Name; }
set
{
_Name = value;
}
}
public string Forename
{
get { return _forename; }
set
{
_forename = value;
}
}
}
感谢任何提示、教程或代码 sn-ps。
真诚的 标记
【问题讨论】:
标签: c# wpf wpf-controls custom-controls dependency-properties