Wrong computed size of control in Grid

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

Wrong computed size of control in Grid

Postby cnayan » Mon Nov 21, 2016 1:13 am

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

cnayan
Posts: 7
Joined: Sat Oct 15, 2016 8:10 am

Re: Wrong computed size of control in Grid

Postby cnayan » Mon Nov 21, 2016 1:16 am

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

JS-Support
Site Admin
Posts: 789
Joined: Tue Apr 08, 2014 3:42 pm

Re: Wrong computed size of control in Grid

Postby JS-Support » Mon Nov 21, 2016 5:09 am

Hi,

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

Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest

 

 

cron