public RowInfo Panel = new StackPanel Orientation = OrientationHorizontal Margin = thickness ; var startDa
public RowInfo() { Panel = new Grid { Margin = thickness };
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(140) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(140) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(width) });
Panel.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50) });
var startDatePicker = new DatePicker
{
Margin = thickness,
};
Panel.Children.Add(startDatePicker);
Grid.SetColumn(startDatePicker, 0);
var endDatePicker = new DatePicker
{
Margin = thickness,
};
Panel.Children.Add(endDatePicker);
Grid.SetColumn(endDatePicker, 1);
var lightSourceComboBox = new ComboBox
{
Margin = thickness,
ItemsSource = new[] { "光源1", "光源2", "光源3", "光源4", "光源5", "光源6", "光源7", "光源8", "光源9", "光源10", "光源11", "光源12", "光源13", "光源14", "光源15", "光源16", "光源17", "光源18", "光源19", "光源20" },
};
Panel.Children.Add(lightSourceComboBox);
Grid.SetColumn(lightSourceComboBox, 2);
var currentTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(currentTextBox);
Grid.SetColumn(currentTextBox, 3);
var voltageTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(voltageTextBox);
Grid.SetColumn(voltageTextBox, 4);
var pumpAbnormalTemperatureTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(pumpAbnormalTemperatureTextBox);
Grid.SetColumn(pumpAbnormalTemperatureTextBox, 5);
var pumpTemperatureTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(pumpTemperatureTextBox);
Grid.SetColumn(pumpTemperatureTextBox, 6);
var powerAbnormalValueTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(powerAbnormalValueTextBox);
Grid.SetColumn(powerAbnormalValueTextBox, 7);
var powerValueTextBox = new TextBox
{
Margin = thickness,
};
Panel.Children.Add(powerValueTextBox);
Grid.SetColumn(powerValueTextBox, 8);
var switchButton = new Button
{
Content = "开",
Margin = thickness,
};
switchButton.Click += SwitchButton_Click;
Panel.Children.Add(switchButton);
Grid.SetColumn(switchButton, 9);
var image = new Image
{
Source = new BitmapImage(new Uri("pack://application:,,,/img/led_gray.png")),
Width = 30,
Height = 30
};
image.Name = "isImg";
Panel.Children.Add(image);
Grid.SetColumn(image, 10);
原文地址: https://www.cveoy.top/t/topic/cwY0 著作权归作者所有。请勿转载和采集!