下拉组合框不处理选择
本文关键字:处理 选择 组合 | 更新日期: 2023-09-27 18:14:38
我有一个Silverlight WPF应用程序,可以显示数据的选项卡在这种情况下,我有一个新的状态下拉菜单,下面是下拉菜单的样子:
屏幕截图http://www.mediafire.com/download.php?vkwvj6qq6q6zjoz
处理这个的代码在这里:它没有这样做。我们希望用户能够根据组合框中的状态过滤详细视图。知道为什么它不显示任何东西吗?我尝试唯一的状态,我们正在显示"未开始-迟到",它显示一个空白的屏幕。
private String _Type;
private String AssessmentType
{
get { return _Type; }
set { if (this.SetReferenceProperty("AssessmentType", ref _Type, value))
{ RefreshData(); }
}
}
评估类型定义:
private readonly String[] _assessmentType = new String[]
{ "All", "UnCompleted", "Completed", "Incomplete Late",
"NOT STARTED - LATE", "Submitted", "Submitted Late" };
RibbonControlHelper.CreateComboBox("Assessment", "Assessment",
"Select Assessment to show.", _assessmentType, (type) =>
{ AssessmentType = type; }))
protected override void RefreshData()
{
if (FacilitiesAreChanging) { return; }
Loading = true;
SchedulesRepository.Details(FacilitySelectionService.SelectedFacilities,
UnitCode, AssessmentType, StartDate, EndDate,
(schedules) =>
{
var data = new ListCollectionView(schedules);
data.GroupDescriptions.Add(new PropertyGroupDescription
("FACILITY_KEY"));
data.GroupDescriptions.Add(new PropertyGroupDescription
("UNIT"));
Data = data;
Loading = false;
});
}
您看过WPF中的PropertyBinding和DataContext吗?在那里,你可以使用System.Collections.ObjectModel.ObservableCollection http://msdn.microsoft.com/en-us/library/ms668604.aspx将其绑定到数据源,每次集合更改时,ComboBox都会更改content - data本身,而无需手动更新setter中的每个ui - control。