8,734
社区成员
发帖
与我相关
我的任务
分享
<DataGrid Grid.ColumnSpan="5" Name="_dataGrid" ItemsSource="{Binding ThresholdValueList}" FontSize="12" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="参数" Binding="{Binding IndicatorCaption}" Width="*" IsReadOnly="True"></DataGridTextColumn>
<DataGridComboBoxColumn Header="时间间隔" ItemsSource="{Binding DateIntervalList}" TextBinding="{Binding DateInterval,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="*"></DataGridComboBoxColumn>
<DataGridComboBoxColumn Header="数据点数" ItemsSource="{Binding PointNumList}" TextBinding="{Binding DataPointNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="*"></DataGridComboBoxColumn>
<DataGridTextColumn Header="最小值(%)" Binding="{Binding UserMinVal,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="*"></DataGridTextColumn>
<DataGridTextColumn Header="最大值(%)" Binding="{Binding UserMaxVal,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="*"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
public class ThresholdValueModel : BindableBase
{
public int Index { get; set; }
public IndicatorEnum IndicatorID { get; set; }
public string IndicatorCaption { get; set; }
public CalcType CalculateType { get; set; }
public int DateInterval { get; set; }
public int DataPointNum { get; set; }
public float UserMinVal { get; set; }
public float UserMaxVal { get; set; }
public string Description { get; set; }
}
public class BlockIndicatorSettingViewModel : BindableBase
{
private ObservableCollection<ThresholdValueModel> _thresholdValueList;
private List<int> _dateIntervalList = new List<int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
private List<int> _pointNumList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
private bool _isWindowEnable;
public ObservableCollection<ThresholdValueModel> ThresholdValueList
{
get { return _thresholdValueList; }
set
{
_thresholdValueList = value;
OnPropertyChanged("ThresholdValueList");
}
}
public DelegateCommand OkButtonCommand { get; set; }
public List<int> DateIntervalList { get { return _dateIntervalList; } }
public List<int> PointNumList { get { return _pointNumList; } }
}
BlockIndicatorSettingViewModel vm = new BlockIndicatorSettingViewModel();
BlockIndicatorSettingView view = new BlockIndicatorSettingView();
view.DataContext = vm;
view.ShowDialog();