Skip to content

DataGridTemplateColumn is not completely horizontally centered. #4104

@comet7360

Description

@comet7360

I want to place RadioButton and CheckBox completely in the horizontal center in the DataGrid with DataGridTemplateColumn.
But these is not completely horizontally centered.
So I want you to be completely horizontal centered.
datagrid

    <DataGrid Name="dataGrid" AutoGenerateColumns="False" CanUserAddRows="False" GridLinesVisibility="All">
        <DataGrid.Columns>
            <DataGridTemplateColumn Header="RADIO">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <RadioButton HorizontalAlignment="Center" IsChecked="{Binding IsChecked}" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
            <DataGridTemplateColumn Header="CHECK">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsChecked}" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
        </DataGrid.Columns>
    </DataGrid>

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions