reset password
Author Message
BryanYeh
Posts: 38
Posted 19:45 Mar 10, 2013 |

I know you all been eager to find out how to do add snap to your app in Visual Studio. Here's how to do it.  

Let's start by creating a blank app project. I will name the project Snap.

 

In the Solution Explorer, right click Snap(project)-->Add-->New Item...(or just press Ctrl+Shift+A)

 

Add the Basic Page

 

When you added the Basic Page it will ask you if you want it to add the other needed files, click Yes.

 

As you can see it will added these files in the picture in the Common folder

 

Comparing the MainPage.xaml and BasicPage.xaml, you can spot the huge difference in the code.

 

 

Since the MainPage.xaml doesn't support snap we can make the app load the BasicPage.xaml instead of MainPage.xaml by editing the App.xaml.cpp.

In App.xaml.cpp replace MainPage with BasicPage. Note: there are 3 MainPage that needs to be changed, first one is the #include.

You can delete MainPage.xaml and MainPage.xaml.cpp from the project.

 

 

Make sure to run the app once so you can edit the BasicPage.xaml visually.

Now add some buttons and stuff to the BasicPage.xaml, like below

 

Now find Device, somewhere on the right or left of the Visual Studio, if you can't find it go to Design in the Main Menu and click Device.

Note: To see Design in the main menu you must be on the xaml.

 

Now click  the 3rd button the row of View for the snap view and check the box for

Enable state recording. On the top left you will see that it will say, State recording is now on.

This is when you start moving your buttons and stuff that you want to go into the snapped area. 

When you are done moving the buttons, uncheck the Enable state recording box.

Now you can go back to FullScreen view to edit where the buttons and stuff goes, this part is doesn't need to have state recording. 

You can now run the app.

Full Screen View:

 

Snapped Screen View:

This is such a long and hard way to do it, I wish it was easier.(with sarcasm)

Last edited by BryanYeh at 19:52 Mar 10, 2013.
asmiths
Posts: 12
Posted 22:29 Mar 10, 2013 |

Dude, seriously, nice.

I can't believe this isn't the default on studio when you make a windows store app.

I mean, they want us to use snap, filled, and portrait, right?

tmyung
Posts: 11
Posted 22:57 Mar 10, 2013 |

gg