Using Grid, Windows Phone C # Silverlight?

1

Well, I'm having trouble developing apps in Visual Studio, my computer is 32-bit, so there's no way I can test apps with emulator, and test on my own phone, a 4-inch Lumia.

In my last project, which had everything to be a great app, I had the frustration to see it not working on devices with other types of rela, so I related this to the use of the "Grid" tag, we do in html with the divs, to separate the screen into frames and then transform those tables into tables with rows and columns.

My question does not have much to do with code in general, but rather with the use of this tag in general, can excessive use of it possibly compromise the app? There is also the StackPanel that would be a panel, but I do not really know what each one is for and how to use it, could anyone give me a light on it? Well, the rest is cool, I know how to use it, it's just this question that will not let my apps work, I've given up hope for it.

    
asked by anonymous 08.11.2015 / 17:46

1 answer

1

The great benefit of using Grid is its support for creating rows and columns. It works in a similar way to an HTML Table.

I made an app that is published in Windows Phone Store and uses dynamic resizing, that is, the Grid always has 100% of the screen, regardless of the resolution of the device.

A very good article that helped me at the time I made the application, is in Microsoft's own documentation and deals with the layout of applications.

For a "self-tuning" Grid, see the example below:

<Grid ShowGridLines="True" Margin="12,0,12,0">
    <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition />
        <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBox Text="1st row 1st column" TextWrapping="Wrap" Grid.Column="0" Grid.Row="0" />
    <TextBox Text="3rd row 1st column" TextWrapping="Wrap" Grid.Column="0" Grid.Row="2" />
    <Button Content="1st row 2nd column" FontSize="17" Grid.Column="1" Grid.Row="0" />
    <Button Content="3rd row 2nd column" FontSize="17" Grid.Column="1" Grid.Row="2" />
</Grid>

Code Result:

Articlelink: Layout for Windows Phone 8

Hugs.

    
13.11.2015 / 14:59