效果展示:
<DataGrid Grid.Row="1" Margin="20" Background="#05034C" BorderBrush="White" BorderThickness="0,1,1,0" CanUserSortColumns="False" ColumnWidth="*" Focusable="False" Foreground="White" IsReadOnly="True" ItemsSource="{Binding People}" SelectionMode="Single"> <DataGrid.Styles> <Style Selector="DataGrid DataGridCell"> <Setter Property="BorderBrush" Value="White" /> <Setter Property="BorderThickness" Value="1" /> </Style> <Style Selector="DataGrid DataGridColumnHeader"> <Setter Property="Foreground" Value="White" /> <Setter Property="Background" Value="#00163E" /> <Setter Property="BorderBrush" Value="White" /> <Setter Property="BorderThickness" Value="1" /> </Style> </DataGrid.Styles> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding FirstName}" Header="名字" /> <DataGridTextColumn Binding="{Binding LastName}" Header="名字2" /> <DataGridTextColumn Binding="{Binding AgeInYears}" Header="名字" /> </DataGrid.Columns> </DataGrid>
标签:Datagrid,展示,效果,Avalonia From: https://www.cnblogs.com/-Timosthetic/p/18058497