mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
@@ -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"
|
||||||
@@ -15,8 +14,9 @@
|
|||||||
<TabItem Header="DataGrid">
|
<TabItem Header="DataGrid">
|
||||||
<Grid RowDefinitions="Auto, *">
|
<Grid RowDefinitions="Auto, *">
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
<ToggleSwitch Content="Disable" Name="DisableToggle" />
|
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
|
||||||
<ToggleSwitch Content="ScrollViewerHide" Name="ScrollViewerHide" />
|
<ToggleSwitch Content="Inset Content" Name="inset" />
|
||||||
|
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DataGrid Grid.Row="1"
|
<DataGrid Grid.Row="1"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
@@ -25,8 +25,9 @@
|
|||||||
CanUserSortColumns="True"
|
CanUserSortColumns="True"
|
||||||
HeadersVisibility="All"
|
HeadersVisibility="All"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
ScrollViewer.AllowAutoHide="{Binding #ScrollViewerHide.IsChecked}"
|
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||||
IsEnabled="{Binding #DisableToggle.IsChecked}"
|
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||||
|
IsEnabled="{Binding #enable.IsChecked}"
|
||||||
ItemsSource="{Binding GridData1}">
|
ItemsSource="{Binding GridData1}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
|
|||||||
@@ -9,66 +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 Name="autohide" Content="Allow AutoHide" />
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Width="200"
|
|
||||||
Height="200"
|
|
||||||
Margin="10"
|
Margin="10"
|
||||||
|
Width="200" Height="200"
|
||||||
|
AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||||
|
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||||
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
|
|
||||||
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>
|
</ScrollViewer>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -530,6 +530,7 @@
|
|||||||
Name="PART_VerticalScrollbar"
|
Name="PART_VerticalScrollbar"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Orientation="Vertical" />
|
Orientation="Vertical" />
|
||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
@@ -540,6 +541,7 @@
|
|||||||
<ScrollBar
|
<ScrollBar
|
||||||
Name="PART_HorizontalScrollbar"
|
Name="PART_HorizontalScrollbar"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
AllowAutoHide="{Binding Path=(ScrollViewer.AllowAutoHide), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
Height="{DynamicResource ScrollBarSize}"
|
Height="{DynamicResource ScrollBarSize}"
|
||||||
Orientation="Horizontal" />
|
Orientation="Horizontal" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -572,7 +574,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^[(ScrollViewer.AllowAutoHide)=False]">
|
<Style Selector="^.InsetContent">
|
||||||
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
|
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
|
||||||
<Setter Property="Grid.RowSpan" Value="1" />
|
<Setter Property="Grid.RowSpan" Value="1" />
|
||||||
<Setter Property="Grid.ColumnSpan" Value="2" />
|
<Setter Property="Grid.ColumnSpan" Value="2" />
|
||||||
|
|||||||
@@ -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