[英]Error when trying to populate ObservableCollection
Currently I'm trying to populate ObservableCollection but getting this error 目前,我正在尝试填充ObservableCollection,但出现此错误
is not of type "System.Int32" and cannot be used in this generic collection
The Autocompletebox is populated with numbers, and when I try to select an item from the list the error is produced. is not of type "System.Int32" and cannot be used in this generic collection
。自动完成框用数字填充,当我尝试从列表中选择一个项目时,会产生错误。
May I get some guidances towards where I'm going wrong. 我可以得到一些有关我要去哪里出错的指导。
public ObservableCollection<int> number = new ObservableCollection<int>();
public ObservableCollection<int> Number
{
get { return value; }
set
{
number = value;
RaisePropertyChanged("Number");
}
}
public ObservableCollection<PaymentInfo> Payments
{ get; set; }
xaml side: xaml面:
<telerik:RadAutoCompleteBox
SelectedItems="{Binding Number, Mode=TwoWay}"
SelectionMode="Multiple"
ItemsSource="{Binding Payments}"
DisplayMemberPath="PaymentNo"
TextSearchPath="PaymentNo" />
Would define the following property 将定义以下属性
public ObservableCollection<PaymentInfo> SelectedPayments
{
get { return value; }
set
{
number = value;
RaisePropertyChanged("SelectedPayments");
}
}
Bind it to SelectedItems="{Binding SelectedPayments, Mode=TwoWay}"
将其绑定到
SelectedItems="{Binding SelectedPayments, Mode=TwoWay}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.