V1.2
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="MeterConfigInstance"
|
||||
d:DesignHeight="330"
|
||||
d:DesignWidth="360"
|
||||
d:DesignHeight="400"
|
||||
d:DesignWidth="300"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<local:BoolNgConvert x:Key="BoolNgConverter" />
|
||||
<local:SecToStrConvert x:Key="SecToStrConverter" />
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
@@ -23,134 +25,297 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.ColumnSpan="3" Margin="1">
|
||||
<Border
|
||||
Padding="3"
|
||||
Background="LightSteelBlue"
|
||||
CornerRadius="3">
|
||||
|
||||
<DockPanel Background="White">
|
||||
<!--<StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}" />
|
||||
</Border>
|
||||
Margin="15,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="常值/斜率:" />
|
||||
<ToggleButton
|
||||
x:Name="TBSwitchConstSlop"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopCommand}"
|
||||
CommandParameter="{Binding ElementName=TBSwitchConstSlop, Path=IsChecked}"
|
||||
IsChecked="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopPar}"
|
||||
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||
ToolTip="常值和斜率选项" />
|
||||
-->
|
||||
<!-- IsChecked="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopPar}" -->
|
||||
<!--
|
||||
</StackPanel>-->
|
||||
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="起始速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StartValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="结束速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.EndValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="维持时间"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.KeepTime}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=AddCommand}"
|
||||
Content="增加"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="增加程序步骤内的速度设置" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=EditCommand}"
|
||||
Content="修改"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="修改程序步骤内的速度设置,请先选中" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=DeleteCommand}"
|
||||
Content="删除"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="删除程序步骤内的速度设置,请先选中" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="3"
|
||||
Margin="3,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewMeter"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=MeterSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewMeter, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<TextBlock
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
FontSize="18"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}"
|
||||
TextAlignment="Right" />
|
||||
</DockPanel>
|
||||
<TabControl
|
||||
x:Name="MainTabControl"
|
||||
Grid.Row="1"
|
||||
SelectedIndex="{Binding ElementName=MeterConfigInstance, Path=ConstSlopSelectedIndex}">
|
||||
<TabControl.Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignFilledTabControl}" TargetType="TabControl">
|
||||
<!--<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=TBSwitchConstSlop}" Value="True">
|
||||
<Setter Property="SelectedIndex" Value="1" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsChecked, ElementName=TBSwitchConstSlop}" Value="False">
|
||||
<Setter Property="SelectedIndex" Value="0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>-->
|
||||
</Style>
|
||||
</TabControl.Style>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=SwitchConstSlopCommand}" CommandParameter="{Binding ElementName=MainTabControl, Path=SelectedIndex}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<!-- IsEnabled="{Binding IsChecked, ElementName=TBSwitchConstSlop, Converter={StaticResource BoolNgConverter}}" -->
|
||||
<TabItem Header="常值">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding StepNo}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
<StackPanel Margin="10" Orientation="Vertical">
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="16">常值数据</TextBlock>
|
||||
<TextBox
|
||||
Width="200"
|
||||
HorizontalContentAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=ConstantValue}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center">
|
||||
<Button
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding StartValue}"
|
||||
Header="起始速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding EndValue}"
|
||||
Header="终止速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding KeepTime}"
|
||||
Header="持续时间" />
|
||||
</GridView>
|
||||
Margin="0,0,20,0"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=ConstantSaveCommand}"
|
||||
Content="确定"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<!-- IsEnabled="{Binding IsChecked, ElementName=TBSwitchConstSlop}" -->
|
||||
<TabItem Header="斜率">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Margin="0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.8*" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="1.4*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="1,10,0,0">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="序号"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StepNo}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<TextBox.ToolTip>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="新增时自动填充序号;可手动修改序号" />
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="1,10,0,0">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="起始值"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StartValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<TextBox.ToolTip>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="起始值" />
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="1,10,0,0">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="结束值"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.EndValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<TextBox.ToolTip>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="结束值" />
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="3" Margin="1,10,3,0">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="维持时间"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
IsEnabled="True"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.KeepTime, Converter={StaticResource SecToStrConverter}}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled">
|
||||
<TextBox.ToolTip>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="维持时间" />
|
||||
</TextBox.ToolTip>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="2,2"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=AddCommand}"
|
||||
Content="增加"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="增加程序步骤内的速度设置" />
|
||||
<Button
|
||||
Margin="1,2"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=EditCommand}"
|
||||
Content="修改"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="修改程序步骤内的速度设置,请先选中" />
|
||||
<Button
|
||||
Margin="1,2"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=DeleteCommand}"
|
||||
Content="删除"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="删除程序步骤内的速度设置,请先选中" />
|
||||
<StackPanel Margin="2,2,2,2" Orientation="Vertical">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="Blue"
|
||||
Text="时间" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=TotalSlopTime, Converter={StaticResource SecToStrConverter}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=MeterConfigInstance, Path=IsTimeOk}" Value="true">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=MeterConfigInstance, Path=IsTimeOk}" Value="false">
|
||||
<Setter Property="Background" Value="OrangeRed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<StackPanel Margin="1,2,2,2" Orientation="Vertical">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="Blue"
|
||||
Text="循环" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=Cycle, StringFormat=0.0}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=MeterConfigInstance, Path=IsTimeOk}" Value="true">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=MeterConfigInstance, Path=IsTimeOk}" Value="false">
|
||||
<Setter Property="Background" Value="OrangeRed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="1,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewMeter"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=MeterSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewMeter, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="40"
|
||||
DisplayMemberBinding="{Binding StepNo}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding StartValue}"
|
||||
Header="起始值" />
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding EndValue}"
|
||||
Header="结束值" />
|
||||
<GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding KeepTime, Converter={StaticResource SecToStrConverter}}"
|
||||
Header="维持时间" />
|
||||
</GridView>
|
||||
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</ListView>
|
||||
</Border>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user