csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
5.1 KiB
93 lines
5.1 KiB
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:converters="using:Avalonia.Controls.Converters"
|
|
x:ClassModifier="internal">
|
|
|
|
<Design.PreviewWith>
|
|
<ScrollViewer Theme="{DynamicResource FluentMenuScrollViewer}" Width="200" Height="200">
|
|
<StackPanel Spacing="20">
|
|
<TextBlock>Item 1</TextBlock>
|
|
<TextBlock>Item 2</TextBlock>
|
|
<TextBlock>Item 3</TextBlock>
|
|
<TextBlock>Item 4</TextBlock>
|
|
<TextBlock>Item 5</TextBlock>
|
|
<TextBlock>Item 6</TextBlock>
|
|
<TextBlock>Item 7</TextBlock>
|
|
<TextBlock>Item 8</TextBlock>
|
|
<TextBlock>Item 9</TextBlock>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</Design.PreviewWith>
|
|
|
|
<ControlTheme x:Key="FluentMenuScrollViewer" TargetType="ScrollViewer">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="IsScrollChainingEnabled" Value="False" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<DockPanel>
|
|
<RepeatButton DockPanel.Dock="Top"
|
|
BorderThickness="0"
|
|
Background="Transparent"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
RenderTransform="{x:Null}"
|
|
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}">
|
|
<RepeatButton.IsVisible>
|
|
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
|
ConverterParameter="0">
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalScrollBarVisibility" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Offset.Y" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Extent.Height" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Viewport.Height" />
|
|
</MultiBinding>
|
|
</RepeatButton.IsVisible>
|
|
<Viewbox Width="{DynamicResource ScrollBarButtonArrowIconFontSize}"
|
|
Height="{DynamicResource ScrollBarButtonArrowIconFontSize}">
|
|
<Path VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Data="M 19.091797 14.970703 L 10 5.888672 L 0.908203 14.970703 L 0.029297 14.091797 L 10 4.111328 L 19.970703 14.091797 Z"
|
|
Fill="{DynamicResource ScrollBarButtonArrowForeground}"
|
|
Width="20"
|
|
Height="20" />
|
|
</Viewbox>
|
|
</RepeatButton>
|
|
<RepeatButton DockPanel.Dock="Bottom"
|
|
BorderThickness="0"
|
|
Background="Transparent"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
RenderTransform="{x:Null}"
|
|
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}">
|
|
<RepeatButton.IsVisible>
|
|
<MultiBinding Converter="{x:Static converters:MenuScrollingVisibilityConverter.Instance}"
|
|
ConverterParameter="100">
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalScrollBarVisibility" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Offset.Y" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Extent.Height" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Viewport.Height" />
|
|
</MultiBinding>
|
|
</RepeatButton.IsVisible>
|
|
<Viewbox Width="{DynamicResource ScrollBarButtonArrowIconFontSize}"
|
|
Height="{DynamicResource ScrollBarButtonArrowIconFontSize}">
|
|
<Path VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Data="M 18.935547 4.560547 L 19.814453 5.439453 L 10 15.253906 L 0.185547 5.439453 L 1.064453 4.560547 L 10 13.496094 Z"
|
|
Fill="{DynamicResource ScrollBarButtonArrowForeground}"
|
|
Width="20"
|
|
Height="20" />
|
|
</Viewbox>
|
|
</RepeatButton>
|
|
<ScrollContentPresenter Name="PART_ContentPresenter">
|
|
<ScrollContentPresenter.GestureRecognizers>
|
|
<ScrollGestureRecognizer CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
|
|
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}" />
|
|
</ScrollContentPresenter.GestureRecognizers>
|
|
</ScrollContentPresenter>
|
|
</DockPanel>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
<Style Selector="^ /template/ RepeatButton:pointerover > Viewbox > Path">
|
|
<Setter Property="Fill" Value="{DynamicResource ScrollBarButtonArrowForegroundPointerOver}" />
|
|
</Style>
|
|
</ControlTheme>
|
|
</ResourceDictionary>
|
|
|