Avalonia Datagrid

效果展示:

 

  <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>

 

posted @ 2024-03-07 11:18  -Timosthetic  阅读(256)  评论(0编辑  收藏  举报