Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CanUserResize=false for DataGridRowHeader

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?

like image 788
Karl_Schuhmann Avatar asked Sep 20 '13 10:09

Karl_Schuhmann


1 Answers

If you want to disable resizing on your DataGrid then you can do something like this:

<DataGrid CanUserResizeColumns="False" CanUserResizeRows="False" .../>
like image 181
dkozl Avatar answered Sep 26 '22 06:09

dkozl