Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions Material.Avalonia.DataGrid/DataGrid.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:collections="clr-namespace:Avalonia.Collections;assembly=Avalonia.Controls.DataGrid">
<!--TODO: Validation and Focus-->

<Thickness x:Key="DataGridTextColumnCellTextBlockMargin">0</Thickness>

<ControlTheme x:Key="DataGridCellTextBlockTheme" TargetType="TextBlock">
Expand Down Expand Up @@ -264,7 +264,7 @@
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="4">
<Grid RowDefinitions="Auto,*,Auto,Auto" ColumnDefinitions="Auto,*,Auto">
<Grid RowDefinitions="Auto,*,Auto" ColumnDefinitions="Auto,*,Auto">

<DataGridColumnHeader Name="PART_TopLeftCornerHeader" Width="22" />
<DataGridColumnHeadersPresenter Name="PART_ColumnHeadersPresenter" Grid.Column="1" />
Expand All @@ -273,26 +273,33 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}" />

<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.Row="1"
ScrollViewer.IsScrollInertiaEnabled="{TemplateBinding IsScrollInertiaEnabled}">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True"
IsScrollInertiaEnabled="{Binding (ScrollViewer.IsScrollInertiaEnabled), ElementName=PART_RowsPresenter}" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Classes="Modern"
Orientation="Vertical" Grid.Column="2" Grid.Row="1" />
<ScrollBar Name="PART_VerticalScrollbar" Orientation="Vertical"
Grid.Column="2" Grid.Row="1" />

<Grid Grid.Column="1" Grid.Row="2"
ColumnDefinitions="Auto,*">
<Rectangle Name="PART_FrozenColumnScrollBarSpacer" />
<ScrollBar Name="PART_HorizontalScrollbar" Grid.Column="1"
Classes="Modern" Orientation="Horizontal" />
<ScrollBar Name="PART_HorizontalScrollbar" Orientation="Horizontal"
Grid.Column="1"/>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter>

<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
<Setter Property="Grid.RowSpan" Value="2" />
<Setter Property="Grid.ColumnSpan" Value="3" />
</Style>

<Style Selector="^ /template/ ScrollBar">
<Setter Property="Theme" Value="{StaticResource MaterialModernScrollBar}" />
Expand All @@ -309,7 +316,7 @@
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="^:vertical">
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" />
</Style>
</Style>
</ControlTheme>
Expand Down