简体   繁体   中英

Auto-RowHeight in wpf.DataGrid

I had binded DataGrid to my collection, and i need bind height of each row to my property.

Is it possible? Or is there another way, to link height of each row with corresponding property in the collection ?

You can bind Height in the RowStyle .

Assuming you have a property called RowHeight

<DataGrid ItemsSource="{Binding ...}">
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Setter Property="Height" Value="{Binding RowHeight}"/>
        </Style>
    </DataGrid.RowStyle>
</DataGrid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM