Grid Usage, Windows Phone C# Silverlight?

Asked

Viewed 66 times

1

Well, I’m having problems developing apps in Visual Studio, my computer is 32 bits, so there’s no way I can test the 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 of seeing it not work on devices with other types of relationship, so I related this to the use of the tag "Grid", because in it I used several as we do in html with Divs, to separate the canvas into frames and then turn these frames 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 the excessive use of it compromise the app? There is also the Stackpanel that would be a panel, but I do not really know what each one serves and how to use, could someone give me a light on this? 'Cause the rest is cool I know how to use, just this question that don’t let my apps work, I’ve given up hope so.

  • Is developing to WP10? I recommend focusing on WP10 and learning about AdaptiveTrigger not to be frustrated again.

  • I’m developing for Windows Phone 8.X since most smartphones are with the 8.1, I’m waiting a little to migrate the development to the 10. Well, I took out the Grids and put Stackpanel on tomorrow I’m gonna run a test on my girlfriend’s cell phone that has a different resolution than mine.

1 answer

1


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

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

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

For a "self-adjusting" 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:

inserir a descrição da imagem aqui

Article link: Layout for Windows Phone 8

Hugs.

  • I discovered that the error was not the grids, but a method that I was using to receive the resolution of the device (to personalize the burger menu and animations), I know some good websites with tutorials in Portuguese and I have a blog also teaching, if you want to pass.. Now I could finish my second app on Windows Store :)

  • You can pass yes. Knowledge is always good :)

  • The first is eduardorizo.com.br I learned a lot from him and I complemented by putting here in this other: lvilarinho.wordpress.com

Browser other questions tagged

You are not signed in. Login or sign up in order to post.