fix: fixed shake problem of CompareSlider

This commit is contained in:
NaBian 2021-11-07 22:16:13 +08:00
parent 8e123389e4
commit ffd27d83bf
4 changed files with 41 additions and 94 deletions

View File

@ -411,7 +411,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</Setter.Value>
</Setter>
@ -1433,27 +1433,19 @@
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderHorizontal" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="-14,0,-15,0" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="14,0,-15,0" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Left" Width="{TemplateBinding Width}">
<ContentPresenter Content="{TemplateBinding TargetContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" HorizontalAlignment="Left" Width="{TemplateBinding ActualWidth}" />
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="-15,0,15,0" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}">
<ContentPresenter Content="{TemplateBinding SourceContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}" />
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="0,0,0,0" />
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="-15,0" />
</Track.Thumb>
</hc:CompareTrack>
</Border>
@ -1535,27 +1527,19 @@
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderVertical" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="0,-14,0,-15" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="0,-15,0,15" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Bottom" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding TargetContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" VerticalAlignment="Bottom" Height="{TemplateBinding ActualHeight}" />
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="0,14,0,-15" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Top" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding SourceContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" VerticalAlignment="Top" Height="{TemplateBinding ActualHeight}" />
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="30" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" VerticalAlignment="Top" />
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" Height="30" Margin="0,-15" />
</Track.Thumb>
</hc:CompareTrack>
</Border>

View File

@ -44,11 +44,6 @@
<Path Data="{StaticResource EmailGeometry}" Fill="{DynamicResource PrimaryBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Chatroom}}">
<MenuItem.Icon>
<Path Data="{StaticResource GitterGeometry}" Fill="#e52e64"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Blog}}">
<MenuItem.Icon>
<Path Data="{StaticResource CnblogsGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
@ -61,7 +56,7 @@
</ToolBarTray>
<ToolBarTray Orientation="Vertical" Margin="0,16,0,0">
<ToolBar Padding="6" Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}">
<CheckBox IsChecked="True" Margin="0,10,0,0"/>
<CheckBox IsChecked="True" Margin="0,10,0,0" HorizontalAlignment="Center"/>
<Separator Margin="0,10,0,0"/>
<RadioButton Margin="0,10,0,0"/>
<StackPanel>
@ -72,7 +67,7 @@
<Button Content="{ex:Lang Key={x:Static langs:LangKeys.Button}}" Margin="0,10,0,0" Style="{StaticResource ButtonPrimary}"/>
</ToolBar>
<ToolBar Band="1" Padding="6" Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}">
<CheckBox IsChecked="True" Margin="0,10,0,0"/>
<CheckBox IsChecked="True" Margin="0,10,0,0" HorizontalAlignment="Center"/>
<Separator Margin="0,10,0,0"/>
<RadioButton Margin="0,10,0,0"/>
<StackPanel>

View File

@ -331,7 +331,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
@ -412,27 +412,19 @@
<ControlTemplate x:Key="CompareSliderHorizontal" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="-14,0,-15,0" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="14,0,-15,0" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Left" Width="{TemplateBinding Width}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" HorizontalAlignment="Left" Width="{TemplateBinding ActualWidth}"/>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="-15,0,15,0" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}"/>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="0,0,0,0"/>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="-15,0"/>
</Track.Thumb>
</hc:CompareTrack>
</Border>
@ -516,27 +508,19 @@
<ControlTemplate x:Key="CompareSliderVertical" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="0,-14,0,-15" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="0,-15,0,15" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Bottom" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" VerticalAlignment="Bottom" Height="{TemplateBinding ActualHeight}"/>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="0,14,0,-15" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Top" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" VerticalAlignment="Top" Height="{TemplateBinding ActualHeight}"/>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="30" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" VerticalAlignment="Top"/>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" Height="30" Margin="0,-15" />
</Track.Thumb>
</hc:CompareTrack>
</Border>

View File

@ -411,7 +411,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</Setter.Value>
</Setter>
@ -1433,27 +1433,19 @@
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderHorizontal" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="-14,0,-15,0" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="14,0,-15,0" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Left" Width="{TemplateBinding Width}">
<ContentPresenter Content="{TemplateBinding TargetContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" HorizontalAlignment="Left" Width="{TemplateBinding ActualWidth}" />
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="-15,0,15,0" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}">
<ContentPresenter Content="{TemplateBinding SourceContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}" />
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="0,0,0,0" />
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="-15,0" />
</Track.Thumb>
</hc:CompareTrack>
</Border>
@ -1535,27 +1527,19 @@
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderVertical" TargetType="hc:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<hc:CompareTrack Margin="0,-14,0,-15" x:Name="PART_Track">
<hc:CompareTrack x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="0,-15,0,15" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Bottom" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding TargetContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="TargetContent" VerticalAlignment="Bottom" Height="{TemplateBinding ActualHeight}" />
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="0,14,0,-15" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Top" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding SourceContent}" />
</Border>
</RepeatButton.Content>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<ContentPresenter ContentSource="SourceContent" VerticalAlignment="Top" Height="{TemplateBinding ActualHeight}" />
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="30" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" VerticalAlignment="Top" />
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" Height="30" Margin="0,-15" />
</Track.Thumb>
</hc:CompareTrack>
</Border>