feat: simplify ScrollViewerDemo.

This commit is contained in:
Zhang Dian
2025-03-13 13:27:14 +08:00
parent cf90be7cea
commit 1d54b8ca4b
2 changed files with 13 additions and 31 deletions

View File

@@ -3,7 +3,6 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Semi.Avalonia.Demo.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo" xmlns:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo"
d:DesignHeight="450" d:DesignHeight="450"
@@ -17,7 +16,7 @@
<StackPanel Grid.Row="0" Orientation="Horizontal"> <StackPanel Grid.Row="0" Orientation="Horizontal">
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" /> <ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
<ToggleSwitch Content="Inset Content" Name="inset" /> <ToggleSwitch Content="Inset Content" Name="inset" />
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide"></ToggleSwitch> <ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
</StackPanel> </StackPanel>
<DataGrid Grid.Row="1" <DataGrid Grid.Row="1"
Margin="8" Margin="8"

View File

@@ -9,39 +9,22 @@
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="inset" Content="Inset Content" />
<ToggleSwitch Name="autohide" Content="Allow AutoHide"></ToggleSwitch> <ToggleSwitch Name="autohide" Content="Allow AutoHide" />
<ScrollViewer <ScrollViewer
Width="200" Margin="10"
Height="200" Width="200" Height="200"
AllowAutoHide="{Binding #autohide.IsChecked}" AllowAutoHide="{Binding #autohide.IsChecked}"
Classes.InsetContent="{Binding #inset.IsChecked}" Classes.InsetContent="{Binding #inset.IsChecked}"
Margin="10"
HorizontalScrollBarVisibility="Auto"> HorizontalScrollBarVisibility="Auto">
<Grid RowDefinitions="Auto,Auto" <UniformGrid
ColumnDefinitions="Auto,Auto" Rows="2" Columns="2"
Width="300" Height="300"> Width="300" Height="300">
<Rectangle <Rectangle Fill="{DynamicResource SemiYellow2}" />
Grid.Row="0" Grid.Column="0" <Rectangle Fill="{DynamicResource SemiBlue2}" />
Width="150" <Rectangle Fill="{DynamicResource SemiPink2}" />
Height="150" <Rectangle Fill="{DynamicResource SemiGreen2}" />
Fill="{DynamicResource SemiYellow2}" /> </UniformGrid>
<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> </ScrollViewer>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>