mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
feat: add new StyleClass to ScrollViewer: InsetContent
This commit is contained in:
@@ -9,9 +9,13 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||||
|
<ToggleSwitch Name="inset" Content="Inset Content"></ToggleSwitch>
|
||||||
|
<ToggleSwitch Name="autohide" Content="Allow AutoHide"></ToggleSwitch>
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Width="200"
|
Width="200"
|
||||||
Height="200"
|
Height="200"
|
||||||
|
AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||||
|
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||||
Margin="10"
|
Margin="10"
|
||||||
HorizontalScrollBarVisibility="Auto">
|
HorizontalScrollBarVisibility="Auto">
|
||||||
<Grid RowDefinitions="Auto,Auto"
|
<Grid RowDefinitions="Auto,Auto"
|
||||||
@@ -39,37 +43,6 @@
|
|||||||
Fill="{DynamicResource SemiGreen2}" />
|
Fill="{DynamicResource SemiGreen2}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</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>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -229,7 +229,6 @@
|
|||||||
<Setter Property="Height" Value="2" />
|
<Setter Property="Height" Value="2" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
<ControlTheme x:Key="{x:Type ScrollViewer}" TargetType="ScrollViewer">
|
<ControlTheme x:Key="{x:Type ScrollViewer}" TargetType="ScrollViewer">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@@ -278,9 +277,14 @@
|
|||||||
<Setter Property="Opacity" Value="1" />
|
<Setter Property="Opacity" Value="1" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="^.InsetContent /template/ ScrollContentPresenter#PART_ContentPresenter">
|
||||||
|
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||||
|
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="StaticScrollViewer" TargetType="ScrollViewer">
|
<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="Background" Value="Transparent" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ScrollViewer">
|
<ControlTemplate TargetType="ScrollViewer">
|
||||||
|
|||||||
Reference in New Issue
Block a user