Giga
Giga

Reputation: 47

Limit Height of rows for DataGridTextColumn

I have a DataGridTextColumn which shows several rows. Normally those rows are oneliner, but now i had to add a description Column which contains more Text in several lines. That way the height of my rows changes. How can i limit the height of the row to be a single text line. I can do "MaxWidth" but not "MaxHeight" for some reason.

<DataGrid.Columns>
<DataGridTextColumn Header="Header_Txt" Binding="{Binding Result.Header_Txt}" MaxWidth="200"/>
</DataGrid.Columns>

Upvotes: 1

Views: 2377

Answers (2)

HYA
HYA

Reputation: 189

Just use RowHeight property

 <DataGrid RowHeight="22">

Upvotes: 2

Rekshino
Rekshino

Reputation: 7325

DataGridTextColumn has not a MaxHeight property, but the DataGridCell has. So set the CellStyle for the column:

<DataGridTextColumn ...>
    <DataGridTextColumn.CellStyle>
        <Style TargetType="DataGridCell">
            <Setter Property="MaxHeight" Value="22"/>
        </Style>
    </DataGridTextColumn.CellStyle>
</DataGridTextColumn>

Upvotes: 2

Related Questions