添加项目文件。
This commit is contained in:
136
TestingModule/Views/Dialogs/ParameterSetting.xaml
Normal file
136
TestingModule/Views/Dialogs/ParameterSetting.xaml
Normal file
@@ -0,0 +1,136 @@
|
||||
<UserControl x:Class="TestingModule.Views.Dialogs.ParameterSetting"
|
||||
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:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
|
||||
xmlns:local="clr-namespace:TestingModule.Views.Dialogs"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Background="White"
|
||||
xmlns:helpers="clr-namespace:UIShare.Helpers;assembly=UIShare"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Width="420"
|
||||
Height="284"
|
||||
mc:Ignorable="d">
|
||||
<prism:Dialog.WindowStyle>
|
||||
<Style BasedOn="{StaticResource DialogUserManageStyle}"
|
||||
TargetType="Window" />
|
||||
</prism:Dialog.WindowStyle>
|
||||
<UserControl.Resources>
|
||||
<converters:IsEnumTypeConverter x:Key="IsEnumTypeConverter" />
|
||||
<converters:ParameterValueToStringConverter x:Key="ParameterValueToStringConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<GroupBox Padding="10,15,10,0"
|
||||
Header="{Binding Title}"
|
||||
helpers:WindowDragHelper.EnableWindowDrag="True">
|
||||
<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"
|
||||
Text="{Binding Parameter.Name}"
|
||||
materialDesign:HintAssist.Hint="参数名称" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
Orientation="Horizontal">
|
||||
<Label Width="60"
|
||||
VerticalAlignment="Bottom"
|
||||
Content="参数类型*" />
|
||||
<ComboBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Types}"
|
||||
materialDesign:HintAssist.Hint="参数类型"
|
||||
SelectedItem="{Binding Parameter.Type}"
|
||||
/>
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
Orientation="Horizontal">
|
||||
<Label Width="60"
|
||||
VerticalAlignment="Bottom"
|
||||
Content="参数类别*" />
|
||||
<ComboBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Categories}"
|
||||
materialDesign:HintAssist.Hint="参数类别"
|
||||
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}"
|
||||
materialDesign:HintAssist.Hint="参数下限" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
Orientation="Horizontal">
|
||||
<Label Width="60"
|
||||
VerticalAlignment="Bottom"
|
||||
Content="参数上限" />
|
||||
<TextBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Parameter.UpperLimit}"
|
||||
materialDesign:HintAssist.Hint="参数名上限" />
|
||||
</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}}"
|
||||
materialDesign:HintAssist.Hint="参数值"
|
||||
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 Content="取消"
|
||||
Width="70"
|
||||
Command="{Binding CancelCommand}" />
|
||||
<Button Content="保存"
|
||||
Width="70"
|
||||
Margin="20,0"
|
||||
Command="{Binding SaveCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
37
TestingModule/Views/Dialogs/ParameterSetting.xaml.cs
Normal file
37
TestingModule/Views/Dialogs/ParameterSetting.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace TestingModule.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// ParameterSetting.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ParameterSetting : UserControl
|
||||
{
|
||||
public ParameterSetting()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ComboBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender is ComboBox comboBox && !comboBox.IsDropDownOpen)
|
||||
{
|
||||
comboBox.IsDropDownOpen = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user