WPF DataGrid 默认显示行号

<DataGrid
    Name="DataGrid"
    Grid.Row="1"
    Margin="10"
    hc:DataGridAttach.ShowRowNumber="True"
    Background="{StaticResource SecondaryBackground}"
    BorderThickness="1"
    CanUserSortColumns="True"
    IsReadOnly="True"
    ItemsSource="{Binding DeviceDataList}"
    SelectionMode="Single"
    Style="{StaticResource CenterDataGridStyle}"
    VerticalScrollBarVisibility="Visible">

主要是这两个属性
HeadersVisibility=“Row”(不要这个属性)
hc:DataGridAttach.ShowRowNumber=“True”

你可能感兴趣的:(C#,wpf)