WPF栅格左侧带白色去除

WPF栅格左侧带白色去除,wpf,datagrid,wpf-controls,wpfdatagrid,Wpf,Datagrid,Wpf Controls,Wpfdatagrid,我已经在WPF中填充了一个datagrid,但我不知道它的生成按钮类型在网格左侧,我想删除它,如何删除它,有什么想法吗 以下是屏幕截图: 以下是我的xaml代码: <DataGrid Name="Patients" SelectedValuePath="patientid" CanUserResizeRows="False" Background="#942E2A" GridLinesVisibility="None" HorizontalGridLinesBrush

我已经在WPF中填充了一个datagrid,但我不知道它的生成按钮类型在网格左侧,我想删除它,如何删除它,有什么想法吗

以下是屏幕截图:

以下是我的xaml代码:

        <DataGrid Name="Patients" SelectedValuePath="patientid" CanUserResizeRows="False"   Background="#942E2A" GridLinesVisibility="None" HorizontalGridLinesBrush="#73261E" BorderBrush="#73261E" BorderThickness="5"  SelectionChanged="Patients_SelectionChanged" ItemsSource="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10" AutoGenerateColumns="False" Height="400" Width="340">

            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Setter Property="Background" Value="#942E2A" />
                    <Setter Property="FontSize" Value="18" />
                    <Setter Property="Width" Value="150" />
                    <Setter Property="FontFamily" Value="Georgia" />
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="FontWeight" Value="Bold" />
                </Style>
                <Style TargetType="DataGridRow">
                    <Setter Property="Background" Value="#942E2A" />
                    <Setter Property="FontSize" Value="14" />
                    <Setter Property="FontFamily" Value="Georgia" />
                    <Setter Property="Foreground" Value="White" />

                    <Style.Triggers>
                        <Trigger Property="IsSelected"
                Value="True">
                            <Setter Property="BorderBrush"
                Value="White" />
                            <Setter Property="BorderThickness"
                Value="2" />
                            <Setter Property="Background"
                Value="White" />
                            <Setter Property="Foreground" Value="Black"></Setter>
                        </Trigger>
                    </Style.Triggers>

                </Style>
            </DataGrid.Resources>

            <DataGrid.Columns>

                <DataGridTemplateColumn Header="Patient ID" SortMemberPath="patientid" Width="Auto" MinWidth="100" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.Style>
                                    <Style>

                                    </Style>
                                </Grid.Style>

                                <TextBlock Text="{Binding Path=patientid}">
                                </TextBlock>
                            </Grid>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Last, First" SortMemberPath="name" Width="Auto" MinWidth="100" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.Style>
                                    <Style>

                                    </Style>
                                </Grid.Style>
                                <TextBlock Text="{Binding Path=name}"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

            </DataGrid.Columns>

        </DataGrid>

有点奇怪,但行有一个标题。这就是你看到的。仅设置列标题的可见性将解决您的问题:

HeadersVisibility="Column"