10

You can disable resizing the columns of a datagrid.

Is there a way to stop resizing the rowsheader Height

At this moment the user can resize the row Headers. Like this:

Guten Tag

I want to disable this. So it should always look:

enter image description here

That's my RowHeaderTemplate

         <DataGrid.RowHeaderTemplate>
            <DataTemplate>
                <DockPanel FlowDirection="LeftToRight" DataContext="{Binding Item,RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}">
                    <TextBlock Text="{Binding ZimmerNummer}" MinWidth="48" MaxWidth="48" />
                </DockPanel>
            </DataTemplate>
        </DataGrid.RowHeaderTemplate>

That was my idea:

<DataGrid.RowHeaderStyle>
    <Style TargetType="DataGridRowHeader">
        <Setter Property="MaxHeight"
            Value="55"/>
    </Style>
</DataGrid.RowHeaderStyle>

But it was not work. That was the result:

enter image description here

Do someone know a Solution for that?

4

1 回答 1

25

如果要禁用调整大小,DataGrid则可以执行以下操作:

<DataGrid CanUserResizeColumns="False" CanUserResizeRows="False" .../>
于 2013-09-20T10:48:51.270 回答