forum

Home / DeveloperSection / Forums / Set grid to 75% of parent grid using WPF

Set grid to 75% of parent grid using WPF

Andrew Deniel 3899 14-Oct-2013
<ScrollViewer Grid.Row="2">

    <Grid>
        <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
        <Grid Grid.Row="0" HorizontalAlignment="Left" Margin="10,5,0,0" Width="500">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.Background >
                    <ImageBrush ImageSource="Public\Images\chat_green-textarea.png"/>
                </Grid.Background>
                <TextBlock Padding="5" Foreground="White" FontSize="15" TextWrapping="Wrap">Lorem Ipsum is simply dummy text of the printing and typesetting industry.
 </TextBlock>
            </Grid>
            <Grid Grid.Row ="1">
                <Image Source="Public\Images\chat_green-textarea-tail.png" Height="20" Width="30" HorizontalAlignment="Left" Margin="10,-4,0,0"/>
            </Grid>
        </Grid>
    </Grid>
</ScrollViewer>

I am displaying a Text in
a Grid, but I want its max width
to be set equals to the 75% of its parent grid. Thanks!


wpf wpf 
Updated on 14-Oct-2013

Can you answer this question?


Answer

1 Answers

Liked By