locked
How to set button height same as the grid row height.

    Question

  • Hello,

    How can I make my button height same as the height of Grid row in which it is placed.

     <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="90*"/>
                </Grid.RowDefinitions>
                <Button Content="My Button"/>
     </Grid>

    Thanks in advance.


    • Edited by zee_patel Thursday, March 13, 2014 11:13 AM
    Thursday, March 13, 2014 11:13 AM

Answers


  • Set the VerticalAlignment property of the Button to Stretch:

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="10*"/>
                <RowDefinition Height="90*"/>
            </Grid.RowDefinitions>
            <Button Content="My Button" VerticalAlignment="Stretch"/>
        </Grid>
    

    • Marked as answer by zee_patel Thursday, March 13, 2014 1:43 PM
    Thursday, March 13, 2014 1:33 PM