我有一个Silverlight WPF应用程序,在这种情况下显示数据选项卡我在这里有一个新的状态下拉是下拉的样子:
screen shot http://www.mediafire.com/download.php?vkwvj6qq6q6zjoz
处理它的代码在这里:它没有这样做。我们希望用户能够按该组合框中的状态过滤详细信息视图。任何想法为什么它不会显示任何东西。我尝试唯一的状态,我们显示'NOT STARTED - LATE'并显示一个空白屏幕。
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;
});
}
答案 0 :(得分:1)
您是否在WPF中查看过PropertyBinding和DataContext?在那里你可以使用System.Collections.ObjectModel.ObservableCollection http://msdn.microsoft.com/en-us/library/ms668604.aspx将它绑定到DataSource,每次集合更改时,ComboBox都会更改Conntent-Datat本身,而无需手动更新setter中的每个UI-Controll。