Browse Source

Remove AlternatingRowBackground from the API

pull/9179/head
Max Katz 4 years ago
parent
commit
f47f71c08d
  1. 3
      samples/ControlCatalog/Pages/DataGridPage.xaml
  2. 25
      src/Avalonia.Controls.DataGrid/DataGrid.cs
  3. 7
      src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml
  4. 5
      src/Avalonia.Controls.DataGrid/Themes/Simple.xaml

3
samples/ControlCatalog/Pages/DataGridPage.xaml

@ -45,8 +45,7 @@
<CheckBox x:Name="ShowGDP" IsChecked="True" Content="Toggle GDP Column Visibility"
DockPanel.Dock="Top"/>
<DataGrid Name="dataGrid1" Margin="12" CanUserResizeColumns="True" CanUserReorderColumns="True" CanUserSortColumns="True" HeadersVisibility="All"
RowBackground="#1000"
AlternatingRowBackground="#1fff">
RowBackground="#1000">
<DataGrid.Columns>
<!-- Using HeaderTemplate -->
<DataGridTextColumn Header="Country" HeaderTemplate="{StaticResource Demo.DataTemplates.CountryHeader}" Binding="{Binding Name}" Width="6*" />

25
src/Avalonia.Controls.DataGrid/DataGrid.cs

@ -246,23 +246,6 @@ namespace Avalonia.Controls
set { SetValue(ColumnWidthProperty, value); }
}
public static readonly StyledProperty<IBrush> AlternatingRowBackgroundProperty =
AvaloniaProperty.Register<DataGrid, IBrush>(nameof(AlternatingRowBackground));
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush" /> that is used to paint the background of odd-numbered rows.
/// </summary>
/// <returns>
/// The brush that is used to paint the background of odd-numbered rows. The default is a
/// <see cref="T:System.Windows.Media.SolidColorBrush" /> with a
/// <see cref="P:System.Windows.Media.SolidColorBrush.Color" /> value of white (ARGB value #00FFFFFF).
/// </returns>
public IBrush AlternatingRowBackground
{
get { return GetValue(AlternatingRowBackgroundProperty); }
set { SetValue(AlternatingRowBackgroundProperty, value); }
}
public static readonly StyledProperty<int> FrozenColumnCountProperty =
AvaloniaProperty.Register<DataGrid, int>(
nameof(FrozenColumnCount),
@ -2058,7 +2041,7 @@ namespace Avalonia.Controls
forceHorizontalScroll: true);
}
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
@ -2167,7 +2150,7 @@ namespace Avalonia.Controls
return desiredSize;
}
/// <inheritdoc/>
protected override void OnDataContextBeginUpdate()
{
@ -2183,7 +2166,7 @@ namespace Avalonia.Controls
NotifyDataContextPropertyForAllRowCells(GetAllRows(), false);
}
/// <summary>
/// Raises the BeginningEdit event.
/// </summary>
@ -4575,7 +4558,7 @@ namespace Avalonia.Controls
dataGridCell.Content = element;
}
}
private void PreparingCellForEditPrivate(Control editingElement)

7
src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml

@ -232,7 +232,7 @@
<Setter Property="Data" Value="{StaticResource DataGridSortIconDescendingPath}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="DataGridTopLeftColumnHeader" TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
<Setter Property="Template">
<ControlTemplate>
@ -337,10 +337,6 @@
</ControlTemplate>
</Setter>
<Style Selector="^:nth-child(even)">
<Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
</Style>
<Style Selector="^:invalid">
<Style Selector="^ /template/ Rectangle#InvalidVisualElement">
<Setter Property="Opacity" Value="0.4" />
@ -484,7 +480,6 @@
<ControlTheme x:Key="{x:Type DataGrid}" TargetType="DataGrid">
<Setter Property="RowBackground" Value="Transparent" />
<Setter Property="AlternatingRowBackground" Value="Transparent" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />

5
src/Avalonia.Controls.DataGrid/Themes/Simple.xaml

@ -199,10 +199,6 @@
</ControlTemplate>
</Setter>
<Style Selector="^:nth-child(even)">
<Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
</Style>
<Style Selector="^ /template/ Rectangle#BackgroundRectangle">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
@ -299,7 +295,6 @@
<ControlTheme x:Key="{x:Type DataGrid}"
TargetType="DataGrid">
<Setter Property="RowBackground" Value="{DynamicResource ThemeAccentBrush4}" />
<Setter Property="AlternatingRowBackground" Value="#00FFFFFF" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />

Loading…
Cancel
Save