mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-02 15:50:49 +08:00
feat: add new StyleClass to ScrollViewer: InsetContent
This commit is contained in:
@@ -9,9 +9,13 @@
|
||||
mc:Ignorable="d">
|
||||
<ScrollViewer>
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||
<ToggleSwitch Name="inset" Content="Inset Content"></ToggleSwitch>
|
||||
<ToggleSwitch Name="autohide" Content="Allow AutoHide"></ToggleSwitch>
|
||||
<ScrollViewer
|
||||
Width="200"
|
||||
Height="200"
|
||||
AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||
Margin="10"
|
||||
HorizontalScrollBarVisibility="Auto">
|
||||
<Grid RowDefinitions="Auto,Auto"
|
||||
@@ -39,37 +43,6 @@
|
||||
Fill="{DynamicResource SemiGreen2}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<ScrollViewer
|
||||
Width="200"
|
||||
Height="200"
|
||||
Margin="10"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
Theme="{DynamicResource StaticScrollViewer}">
|
||||
<Grid RowDefinitions="Auto,Auto"
|
||||
ColumnDefinitions="Auto,Auto"
|
||||
Width="300" Height="300">
|
||||
<Rectangle
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
Width="150"
|
||||
Height="150"
|
||||
Fill="{DynamicResource SemiYellow2}" />
|
||||
<Rectangle
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Width="150"
|
||||
Height="150"
|
||||
Fill="{DynamicResource SemiBlue2}" />
|
||||
<Rectangle
|
||||
Grid.Row="1" Grid.Column="0"
|
||||
Width="150"
|
||||
Height="150"
|
||||
Fill="{DynamicResource SemiPink2}" />
|
||||
<Rectangle
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Width="150"
|
||||
Height="150"
|
||||
Fill="{DynamicResource SemiGreen2}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -229,7 +229,6 @@
|
||||
<Setter Property="Height" Value="2" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
</ControlTheme>
|
||||
<ControlTheme x:Key="{x:Type ScrollViewer}" TargetType="ScrollViewer">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
@@ -278,9 +277,14 @@
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.InsetContent /template/ ScrollContentPresenter#PART_ContentPresenter">
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="StaticScrollViewer" TargetType="ScrollViewer">
|
||||
<!-- This ControlTheme equivalent to default ScrollViewer with InsetContent style class. It exists for easier setting via style. -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="ScrollViewer">
|
||||
|
||||
Reference in New Issue
Block a user