Page 1 of 1

Wrong computed size of control in Grid

Posted: Mon Nov 21, 2016 1:13 am
by cnayan
So, it appears that the computed size of a rectangle inside a Grid is not always right.

If you create a simple view, with grid having 2 rows, and put a rectangle in second row, the rectangle size is very tiny (or empty.)

Code: Select all

<Page
    x:Class="XTest1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
            <Button
                MinWidth="60"
                Margin="5,0,0,0"
                Content="Search" />
        </StackPanel>

        <Rectangle
            Grid.Row="1"
            Margin="0,5,0,0"
            Fill="#FFFF0000" />
    </Grid>
</Page>


This is against the idea that the control should take up the space in that row,column cell of the grid.

Please confirm if this is a bug.

Thanks,
Nayan

Re: Wrong computed size of control in Grid

Posted: Mon Nov 21, 2016 1:16 am
by cnayan
Update on this:

If I explicitly set the "Stretch" property to "Fill", then the rendering comes out right.

Code: Select all

        <Rectangle
            Grid.Row="1"
            Stretch="Fill"
            Margin="0,5,0,0"
            Fill="#FFFF0000" />

But why should we go on to the explicit path?

The preview rendering in the Visual Studio designer renders correctly without the explicit property set. This should be the outcome in the browsers as well.

Thanks,
Nayan

Re: Wrong computed size of control in Grid

Posted: Mon Nov 21, 2016 5:09 am
by JS-Support @Userware
Hi,

Thanks for reporting this issue. We are going to look into it asap. I'll keep you updated.

Regards,
JS-Support