adidas id uk July 2013
You’ll notice that with this, we are hooking into the DragDelta and DragCompleted events. We are going to use these events to animate our page.
In the OnDragDelta event we will check to see if there has been a Horizontal gesture detected and if so, depending on what pane is already open, show the animation on screen! Take a look at the code below and you’ll notice some tricks to get this done! Basically we calculate how far the user is dragging the content and if he get’s passed DragDistanceToOpen ( or ToClose ), we will start the rest of the animation.
If the user stops the drag gesture before reaching the given distance variable,
we animate the screen to the given distance ( through use of the SetHorizontalOffset method )
Now if you’ll try this in your code you will see that some methods are missing! This because we are using some extension methods.
So with all this in place you will get a nice settings pane example with drag gestures enabled, just like the facebook app if they do it the same way? I doubt it
So, we all took a good look at the ‘new design’ we got with the new Facebook app for Windows Phone and what is one of the most remarkable changes? That the settingspane now slides in/out from the left Take a look at it here:
So not a different page like we are used too in Windows Phone. So let’s get started at creating our own version!
Just fire up your Visual Studio and create a new Databound Windows Phone app, it will already contain a MainPage with some data on it. So we will set it’s margin to 480. The complete xaml looks like this:
Next we just need to toggle between the 2 pages to get this done, we’ll add an appbar with an appbar icon.
For good reference,
rename the group to SettingsStateGroup ( by double clicking on the name ). Also press the Add State button twice and rename those states to SettingsOpenState and SettingsClosedState
Now select the SettingsOpenState as active item and when you do this, you will notice a ‘recording is on’ message inside the design pane! This is needed, because we are going to tweak the layout
When the recording of SettingsOpenState is active, select the LayoutRoot grid and in the Properties tab, change the Projection Global Offset X value to 380
After that, select the SettingsPane grid and also change the Global Offset X value but now to 480!
With that done there is still one thing to do in Blend and that is add an EasingFunction to the transition. This can be don by clicking the EasingFunction button of the Default Transition inside the SettingsStateGroup