콤보 상자에 일부 데이터 형식을 표시하려고합니다. 데이터 유형은 다음 클래스에 싸여있다 :활동 데이터 바인딩 wf 4.0
public class TDataTypeBinder: INotifyPropertyChanged
{
private string name;
public string Name
{
get
{
return name ;
}
set
{
name = value;
OnPropertyChanged("Name");
}
}
private DataType datatype;
public DataType Datatype
{
get
{
return datatype;
}
set
{
datatype = value;
OnPropertyChanged("Datatype");
}
}
/// <summary>
/// Initializes a new instance of the <see cref="TDataTypeBinder"/> class.
/// </summary>
/// <param name="valueToSelect">The value to select.</param>
public TDataTypeBinder(string valueToSelect)
{
Name = valueToSelect;
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propName)
{
PropertyChangedEventHandler eh = this.PropertyChanged;
if (null != eh)
{
eh(this, new PropertyChangedEventArgs(propName));
}
}
}
현재 내가 바인딩 속성을 가지고 :
WorkflowElement에서 XAML을 통해 연결됩니다public CollectionView DatatypesDisplayed
{
get
{
List<TDataTypeBinder> list = new List<TDataTypeBinder>();
list.Add(new TDataTypeBinder("String"));
list.Add(new TDataTypeBinder("Float"));
list.Add(new TDataTypeBinder("Integer"));
myDatatypes = new CollectionView(list);
return myDatatypes;
}
}
: 나는 그나마
<... WorkflowViewElement ...
<ComboBox Name="gType" ItemsSource="{Binding Path=ModelItem.DatatypesDisplayed }" DisplayMemberPath="Name" Margin="3" MinWidth="150" Height="20" />
내 콤보 박스에있는 걸 얻으십시오 gType
. 내가 뭘 잘못 했니? WPF와 Workflow 4.0에 익숙하지 않아서이게 어렵지 않을 것 같아. 조언에
감사합니다, 엘
감사합니다. 내 CollectionView가 null 초기 값이 아닙니다. WF에서 내 디자이너를 정의 할 때 DataContext를 설정해야합니까? 어떻게 DataContext를 설정할 수 있습니까? – elCapitano