Skip to content

Commit

Permalink
Add MaterialModernScrollViewer style. Fix #207 #265
Browse files Browse the repository at this point in the history
  • Loading branch information
SKProCH committed Feb 1, 2024
1 parent 4f8d2e9 commit 5ce5349
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 39 deletions.
96 changes: 62 additions & 34 deletions Material.Demo/Pages/ScrollViewerDemo.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,68 @@
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Class="Material.Demo.Pages.ScrollViewerDemo">
<StackPanel Margin="16, 0">
<StackPanel.Styles>
<Style Selector="controls|Card">
<Setter Property="Margin" Value="8" />
</Style>
</StackPanel.Styles>
<TextBlock Classes="Headline4 Subheadline" Text="ScrollViewer" />
<StackPanel Margin="16, 0">
<StackPanel.Styles>
<Style Selector="controls|Card">
<Setter Property="Margin" Value="8" />
</Style>
</StackPanel.Styles>
<TextBlock Classes="Headline4 Subheadline" Text="ScrollViewer" />

<WrapPanel HorizontalAlignment="Stretch">
<WrapPanel HorizontalAlignment="Stretch">
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Material" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewerDefault">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>

<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer (standard mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer1">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>

<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer (No auto-hide mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer0">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Classes="classic no-auto-hide">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</WrapPanel>
</StackPanel>
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Material (No auto-hide mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewerDefaultNoAutoHide">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Classes="no-auto-hide">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</WrapPanel>

<WrapPanel HorizontalAlignment="Stretch">
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Modern" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewerModern">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Theme="{StaticResource MaterialModernScrollViewer}">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>

<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Modern (No auto-hide mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewerModernNoAutoHide">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Theme="{StaticResource MaterialModernScrollViewer}"
Classes="no-auto-hide">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</WrapPanel>
</StackPanel>
</UserControl>
10 changes: 5 additions & 5 deletions Material.Styles/Resources/Themes/ScrollViewer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@

<ControlTheme x:Key="{x:Type ScrollViewer}" TargetType="ScrollViewer"
BasedOn="{StaticResource MaterialScrollViewer}" />


<ControlTheme x:Key="NoAutoHideScrollViewer"
<!-- Modern -->
<ControlTheme x:Key="MaterialModernScrollViewer"
BasedOn="{StaticResource MaterialScrollViewer}"
TargetType="ScrollViewer">
<Style Selector="^ /template/ ScrollBar">
<Setter Property="AllowAutoHide" Value="False" />
<Setter Property="Theme" Value="{StaticResource MaterialModernScrollBar}" />
</Style>

<Style Selector="^ /template/ Rectangle#PART_CornerFillRectangle">
<Setter Property="Opacity" Value="0.7" />
<Setter Property="IsVisible" Value="False" />
</Style>
</ControlTheme>
</ResourceDictionary>

0 comments on commit 5ce5349

Please sign in to comment.