Files
EgtWPFLib5/StringParamWithButtonV.xaml
2025-03-21 23:42:17 +01:00

154 lines
11 KiB
XML

<UserControl x:Class="StringParamWithButtonV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="EgtWPFLib5Resources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#F3F3F3" Offset="0"/>
<GradientStop Color="#EBEBEB" Offset="0.5"/>
<GradientStop Color="#DDDDDD" Offset="0.5"/>
<GradientStop Color="#CDCDCD" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
<Style x:Key="ToggleButtonStyleManage" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
<Setter Property="Background" Value="{Binding BackgroundIsChecked,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Setter Property="BorderBrush" Value="{Binding BorderBrushIsChecked,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Setter Property="BorderThickness" Value="{Binding BorderThicknessIsChecked,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Setter Property="Foreground" Value="{Binding ForegroundIsChecked,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="border" CornerRadius="0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="{Binding OpacityIsChecked,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid Style="{DynamicResource Param_GpBxHeaderAlignment}">
<Grid.Resources>
<EgtWPFLib5:DepthUnitConverter x:Key="DepthUnitConverter"/>
<EgtWPFLib5:ErrorVisibilityConverter x:Key="ErrorVisibilityConverter"/>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding ParamTxBl,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Foreground="{Binding ForegroundParamBtnTxBl,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Style="{DynamicResource MachiningsToolTextBlock}"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<EgtWPFLib5:EgtTextBox x:Name="TextValue" Grid.Column="0"
BorderBrushIsMouseOver="{Binding BorderBrushIsMouseOver,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
GeneralBorderBrush="{Binding GeneralBorderBrush,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderBrushIsFocused="{Binding BorderBrushIsFocused,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BackgroundBrdEnable="{Binding BackgroundBrdEnable,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BackgroundBrdDisable="{Binding BackgroundBrdDisable,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BackgroundTxBlDisable="{Binding BackgroundTxBlDisable,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ForegroundTxBlEnable="{Binding ForegroundTxBlEnable,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ForegroundTxBlDisable="{Binding ForegroundTxBlDisable,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
GeneralForeground="{Binding GeneralForeground,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
GeneralBackground="{Binding GeneralBackground,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Text="{Binding ParamTxBx,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
Margin="0,3,3,3"/>
<ToggleButton Style="{DynamicResource ToggleButtonStyleManage}" Grid.Column="1" Margin="0,3,3,3" Content="A" Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
IsChecked="{Binding AutoToolParamChecked,
Mode=TwoWay,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}}}"
IsEnabled="{Binding AutoToolParamEnabled,
Mode=TwoWay,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}}}"/>
</Grid>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{DynamicResource ValidationErrorTextBlock}"
Text="{Binding ParamErrorMsg,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}}}"
Visibility="{Binding ParamErrorMsg,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:StringParamWithButtonV}},
Converter={StaticResource ErrorVisibilityConverter}}"
Margin="0,0,0,3"/>
</Grid>
</UserControl>