BDU/BDU/Windows/ParameterSettingWindow.xaml
2026-03-16 14:24:10 +08:00

123 lines
6.4 KiB
XML

<mah:MetroWindow x:Class="BDU.Windows.ParameterSettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BDU.Windows"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="ParameterSettingWindow"
Width="420"
Height="284"
d:DataContext="{d:DesignInstance Type=local:ParameterSettingWindow}"
ShowTitleBar="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Grid>
<GroupBox Padding="10,15,10,0"
Header="参数编辑界面"
MouseLeftButtonDown="GroupBox_MouseLeftButtonDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<ScrollViewer>
<StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数名称*" />
<TextBox Width="120"
VerticalAlignment="Bottom"
Text="{Binding Parameter.Name}" />
</StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数类型*" />
<ComboBox Width="120"
VerticalAlignment="Bottom"
ItemsSource="{Binding Types}"
SelectedItem="{Binding Parameter.Type}"
SelectionChanged="ParaType_SelectionChanged" />
</StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数类别*" />
<ComboBox Width="120"
VerticalAlignment="Bottom"
ItemsSource="{Binding Categorys}"
Text="{Binding Parameter.Category}" />
</StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数下限" />
<TextBox Width="120"
VerticalAlignment="Bottom"
Text="{Binding Parameter.LowerLimit}" />
</StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数上限" />
<TextBox Width="120"
VerticalAlignment="Bottom"
Text="{Binding Parameter.UpperLimit}" />
</StackPanel>
<StackPanel Height="30"
Margin="7"
Orientation="Horizontal">
<Label Width="60"
VerticalAlignment="Bottom"
Content="参数值" />
<!-- 非枚举类型时显示文本框 -->
<TextBox MinWidth="120"
VerticalAlignment="Bottom"
Text="{Binding Parameter.Value, Converter={StaticResource ParameterValueToStringConverter}}"
Visibility="{Binding Parameter.Type, Converter={StaticResource IsEnumTypeConverter}, ConverterParameter=Collapse}" />
<!-- 枚举类型时显示下拉框 -->
<ComboBox MinWidth="120"
VerticalAlignment="Bottom"
ItemsSource="{Binding EnumValues}"
SelectedItem="{Binding Parameter.Value}"
Visibility="{Binding Parameter.Type, Converter={StaticResource IsEnumTypeConverter}}" />
<CheckBox Margin="10,0"
VerticalAlignment="Bottom"
Content="保存数据"
IsChecked="{Binding Parameter.IsSave}" />
</StackPanel>
</StackPanel>
</ScrollViewer>
<StackPanel Grid.Row="1"
Margin="5,10,5,15"
FlowDirection="RightToLeft"
Orientation="Horizontal">
<Button Width="70"
Click="Cancel_Click"
Content="取消" />
<Button Width="70"
Margin="20,0"
Click="Save_Click"
Content="保存" />
</StackPanel>
</Grid>
</GroupBox>
</Grid>
</mah:MetroWindow>