ad38e4d3e1
This reverts commit 00a338c202.
221 lines
16 KiB
XML
221 lines
16 KiB
XML
<UserControl x:Class="ComboParamV"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5"
|
|
x:Name="PIPPO">
|
|
|
|
<UserControl.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="EgtWPFLib5Resources.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<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"/>
|
|
<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
|
|
<GradientStop Color="#ABADB3" Offset="0.05"/>
|
|
<GradientStop Color="#E2E3EA" Offset="0.07"/>
|
|
<GradientStop Color="#E3E9EF" Offset="1"/>
|
|
</LinearGradientBrush>
|
|
<Style x:Key="ComboBoxFocusVisual">
|
|
<Setter Property="Control.Template">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<Rectangle Margin="4,4,21,4" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Geometry x:Key="DownArrowGeometry">F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z</Geometry>
|
|
<Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
|
|
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
|
<Setter Property="IsTabStop" Value="false"/>
|
|
<Setter Property="Focusable" Value="false"/>
|
|
<Setter Property="ClickMode" Value="Press"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<Border x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}">
|
|
<Grid HorizontalAlignment="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
|
|
<Path x:Name="Arrow"
|
|
Data="{StaticResource DownArrowGeometry}"
|
|
Fill="{Binding ForegroundCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="3,1,0,0" VerticalAlignment="Center"/>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
|
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
|
<Setter Property="IsTabStop" Value="false"/>
|
|
<Setter Property="Focusable" Value="false"/>
|
|
<Setter Property="ClickMode" Value="Press"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<Border x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
|
|
<Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="White" HorizontalAlignment="Center" Margin="0,1,0,0" VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type ComboBox}">
|
|
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
|
|
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
|
|
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
|
<Setter Property="Padding" Value="4,3"/>
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
|
<Grid x:Name="MainGrid" SnapsToDevicePixels="true">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Width="{Binding ActualWidth, ElementName=MainGrid}" >
|
|
<Border x:Name="DropDownBorder" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="{TemplateBinding BorderThickness}">
|
|
<ScrollViewer x:Name="DropDownScrollViewer">
|
|
<Grid RenderOptions.ClearTypeHint="Enabled">
|
|
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
|
<Rectangle x:Name="OpaqueRect"
|
|
Fill="{Binding BackgroundListCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
|
|
</Canvas>
|
|
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
</Grid>
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Popup>
|
|
<ToggleButton Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxReadonlyToggleButton}"/>
|
|
<ContentPresenter ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="HasItems" Value="false">
|
|
<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
|
<Setter Property="Background" Value="#FFF4F4F4"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsGrouping" Value="true"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
|
|
</MultiTrigger>
|
|
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
|
|
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
|
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="Raw_ComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
|
<Setter Property="Background" Value="{Binding BackgroundCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="Foreground" Value="{Binding ForegroundCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="BorderThickness" Value="{Binding BorderThicknessCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="BorderBrush" Value="{Binding BorderBrushCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignmentCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="Height" Value="{Binding HeightCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Setter Property="Width" Value="{Binding WidthCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
</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:ComboParamV}},
|
|
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
Foreground="{Binding ForegroundTextBoxCmBxTxBl,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
|
Style="{DynamicResource MachiningsToolTextBlock}"/>
|
|
<ComboBox x:Name="ComboValue" Grid.Column="1"
|
|
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Path=ParamCmBxList,
|
|
Mode=OneWay}"
|
|
Style="{DynamicResource Raw_ComboBox}"
|
|
SelectedIndex="{Binding RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Path=ParamCmBxSelIndex,
|
|
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
DisplayMemberPath="{Binding RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Path=ParamDisplayMemberPath,
|
|
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
IsSynchronizedWithCurrentItem="True" Margin="0,3,3,3"/>
|
|
|
|
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{DynamicResource ValidationErrorTextBlock}"
|
|
Text="{Binding ParamErrorMsg,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}}}"
|
|
Visibility="{Binding ParamErrorMsg,
|
|
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:ComboParamV}},
|
|
Converter={StaticResource ErrorVisibilityConverter}}"
|
|
Margin="0,0,0,3"/>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|
|
|
|
|