这里我收到此错误消息:
错误5之间的歧义 'OPTFDashboard.Common.Modules.CNAAll.ViewModels.CNAAllViewModel.Shift' 和 'OPTFDashboard.Common.Modules.CNAAll.ViewModels.CNAAllViewModel.Shift'C:\ OPTFDashboard \ Common \ Modules \ CNAAll \ ViewModels \ CNAAllViewModel.cs 34 117 Common
我正在尝试绑定选定的护士班次(day,eve,all)来刷新每次选择时显示的数据。
using System;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Windows.Data;
using OPTFDashboard.Common.Modules.CNABathing.DataAccess;
using OPTFDashboard.Common.Ribbon;
using OPTFDashboard.Common.Utility;
using OPTFDashboard.DataModel;
using OPTFDashboard.ViewModel;
using OPTFDashboard.Common.Modules.CNAAll.DataAccess;
namespace OPTFDashboard.Common.Modules.CNAAll.ViewModels
{
[Export]
class CNAAllViewModel : TabViewModel, ISelectedContentTab
{
private readonly String[] _shift = new String[] { "ALL", "DAY", "EVE", "NIGHT" };
public CNAAllViewModel()
: base()
{
DisplayName = "All CNA";
StartDate = DateTime.Now.AddMonths(-3);
EndDate = DateTime.Now.AddDays(19);
GroupDataCollection = new ObservableCollection<GroupData>()
{
RibbonControlHelper.CreateFacilitySelection()
, new GroupData("Criterria"
, RibbonControlHelper.CreateDateSelection(StartDate,EndDate,(s, e) => { StartDate = s; EndDate = e; RefreshData(); })
, RibbonControlHelper.CreateUnitSelection(UnitChanged)
, RibbonControlHelper.CreateComboBox("Shift", "Shift", "Select Shift to show.", _shift, (type) => { Shift = type; })
)
};
}
private string Shift;
private DateTime startDate;
public DateTime StartDate
{
get { return startDate; }
set { startDate = value; }
}
private DateTime endDate;
public DateTime EndDate
{
get { return endDate; }
set { endDate = value; }
}
public ObservableCollection<GroupData> GroupDataCollection { get; private set; }
private String UnitCode { get; set; }
private void UnitChanged(Unit unit)
{
UnitCode = unit == null ? "" : unit.Description;
RefreshData();
}
protected override void RefreshData()
{
if (FacilitiesAreChanging) { return; }
Loading = true;
// this is the details section.
// Load CNABathing
CNAAllRepository.DetailedCNABathing(FacilitySelectionService.SelectedFacilities, StartDate, EndDate, UnitCode,
(cnabathingdetails) =>
{
var data = new ListCollectionView(cnabathingdetails);
data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
DataCNABathing = data;
});
CNAAllRepository.DetailedCNABowel(FacilitySelectionService.SelectedFacilities, startDate, endDate, UnitCode,
(cna) =>
{
var data = new ListCollectionView(cna);
data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
DataCNABowel = data;
});
CNAAllRepository.DetailedCNAIntakeVSOutput(FacilitySelectionService.SelectedFacilities, StartDate, EndDate, UnitCode,
(CNAIntakeVSOutputDetails) =>
{
var data = new ListCollectionView(CNAIntakeVSOutputDetails);
data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
DataCNAIntakeVSOutput = data;
});
CNAAllRepository.DetailedCNAPoorEating((FacilitySelectionService.SelectedFacilities), startDate, endDate, UnitCode, "0",
(cnaPoorEatingDetail) =>
{
var data = new ListCollectionView(cnaPoorEatingDetail);
data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
DataCNAPoorEating = data;
});
Loading = false;
}
private ListCollectionView _DataCNABathing;
public ListCollectionView DataCNABathing
{
get { return _DataCNABathing; }
set { this.SetReferenceProperty("DataCNABathing", ref _DataCNABathing, value); }
}
private ListCollectionView _DataCNABowel;
public ListCollectionView DataCNABowel
{
get { return _DataCNABowel; }
set { this.SetReferenceProperty("DataCNABowel", ref _DataCNABowel, value); }
}
private ListCollectionView _DataCNAIntakeVSOutput;
public ListCollectionView DataCNAIntakeVSOutput
{
get { return _DataCNAIntakeVSOutput; }
set { this.SetReferenceProperty("DataCNAIntakeVSOutput", ref _DataCNAIntakeVSOutput, value); }
}
private ListCollectionView _DataCNAPoorEating;
public ListCollectionView DataCNAPoorEating
{
get { return _DataCNAPoorEating; }
set { this.SetReferenceProperty("DataCNAPoorEating", ref _DataCNAPoorEating, value); }
}
// here we will put the shift pulldown :
private String _Type;
private String Shift
{
get { return _Type; }
set { if (this.SetReferenceProperty("Shift", ref _Type, value)) { RefreshData(); } }
}
}
}
答案 0 :(得分:2)
您有一个名为Shift
的私有财产,以及一个名为Shift
的私人字段。删除其中一个。
private string Shift;
...
private String Shift
{
get { return _Type; }
set { if (this.SetReferenceProperty("Shift", ref _Type, value)) { RefreshData(); } }
}