Trouble getting relative grid cell cell sizes

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
SchnauzerDad
Posts: 8
Joined: Fri Jun 17, 2016 6:27 am

Trouble getting relative grid cell cell sizes

Postby SchnauzerDad » Tue Aug 30, 2016 12:20 pm

I am having trouble getting grid cells to have the relative sizes I expect. I am sure it is just me doing something dumb but I can't seem to figure it out.

If I make a grid with two rows and two columns all set to "1*" I would expect that the result would be 4 equal sized cells (and in fact that is exactly what the designer shows).

Here is my code:

Code: Select all

<Page
    x:Class="CSHTML_9_1_Test.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CSHTML_9_1_Test"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Grid x:Name="mainGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0" Grid.Row="0" Background="Yellow">
            <TextBlock Text="Location 0,0" Padding="15,15,15,15"/>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="0" Background="LightGreen">
            <TextBlock Text="Location 1,0" Padding="15,15,15,15"/>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="1" Background="LightBlue">
            <TextBlock Text="Location 0,1" Padding="15,15,15,15"/>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="1" Background="Pink">
            <TextBlock Text="Location 1,1" Padding="15,15,15,15"/>
        </StackPanel>
    </Grid>
</Page>


I expect this:

Expected.PNG
Expected.PNG (5.16 KiB) Viewed 6290 times


But when I run it I get this:

Actual.PNG
Actual.PNG (27.64 KiB) Viewed 6290 times


Can anyone tell me what I am doing wrong?

Thanks

SchnauzerDad
Posts: 8
Joined: Fri Jun 17, 2016 6:27 am

Re: Trouble getting relative grid cell cell sizes

Postby SchnauzerDad » Fri Sep 02, 2016 11:42 am

I have tried everything I can think of and (a) this definitely not right compared to UWP and WPF behavior of the same code and (b) I just can't find any way to make it work as expected. Any help or comment from support?

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

Re: Trouble getting relative grid cell cell sizes

Postby JS-Support @Userware » Sat Sep 03, 2016 12:00 am

Hi,

Unfortunately this is a known issue that is due to the current "pure html" (no js) implementation of the Grid. Sorry for the inconvenience.

We plan to reengineer the Grid control in the coming months.

In the meantime, you may need to set some fixed sizes or use "auto", or put other controls inside the cells. If you would like to achieve the exact same result, you can attach to the SizeChanged event that is coming in Beta 9.2 (in just a few days) and set the position and sizes programmatically (in a canvas for example) based on the value of ActualWidth / 2 and ActualHeight / 2.

Thanks.
Regards
JS-Support

SchnauzerDad
Posts: 8
Joined: Fri Jun 17, 2016 6:27 am

Re: Trouble getting relative grid cell cell sizes [solved]

Postby SchnauzerDad » Sun Sep 04, 2016 10:40 am

Just tried it with the new SizeChanged event in 9.2 and works fine.

Thank you


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 30 guests

 

 

cron