Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 菜单上下两个滚动按钮同时出现的问题 #524

Merged
merged 2 commits into from
Nov 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions src/Shared/HandyControl_Shared/Themes/Styles/ScrollViewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
<Setter Property="Height" Value="10"/>
<Setter Property="Padding" Value="0,2"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="ClickMode" Value="Hover"/>
</Style>

<ControlTemplate x:Key="ScrollViewerUpDownControlTemplate" TargetType="ScrollViewer">
Expand All @@ -39,9 +30,27 @@
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<RepeatButton Style="{StaticResource ScrollViewerUpDownRepeatButtonStyle}" hc:IconElement.Geometry="{StaticResource UpGeometry}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="{x:Static ScrollBar.LineUpCommand}"/>
<RepeatButton Style="{StaticResource ScrollViewerUpDownRepeatButtonStyle}" hc:IconElement.Geometry="{StaticResource UpGeometry}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="{x:Static ScrollBar.LineUpCommand}">
<RepeatButton.Visibility>
<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
</MultiBinding>
</RepeatButton.Visibility>
</RepeatButton>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="1"/>
<RepeatButton Style="{StaticResource ScrollViewerUpDownRepeatButtonStyle}" hc:IconElement.Geometry="{StaticResource DownGeometry}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}"/>
<RepeatButton Style="{StaticResource ScrollViewerUpDownRepeatButtonStyle}" hc:IconElement.Geometry="{StaticResource DownGeometry}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}">
<RepeatButton.Visibility>
<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
</MultiBinding>
</RepeatButton.Visibility>
</RepeatButton>
</Grid>
</ControlTemplate>

Expand Down