Any app, be it a normal desktop app, web app, mobile app or tablet app – requires controls. Right from the Page (yes, page is also a control within a frame) to textbox, button, etc. are all controls and they play a key role in building these apps. With latest update to Windows Phone, there are lots of (and good) updates to controls available in Windows Phone SDK. In this post, we’ll try to cover these updates. As I said, there are lots of updates, we’ll cover them in parts. This is part one.
In-Built Theming Support
While implementing (or forcing) themes in Windows Phone 8 apps, you as a developer had to depend on some third party libraries. One famous library by Jeff, ThemeManager was very helpful. With 8.1, theming is in built into Windows Phone, just like Windows store apps. You can use RequestedTheme property to set the desired theme. Also, you don’t need to restart the app to take theming into the effect.
Icing on the cake: This property is available to all UIElement, that means, you can set it not for just page but also to StackPanel, TextBox, etc. as well & design your UI as you wish.
Head For All
Remember arranging that TextBlock just above the TextBox to give a label to it? Now, you don’t need to juggle with it. Almost every input control like TextBox, DatePicker, TimePicker has a Header property. And apart from it, controls like TextBox also have a PlaceholderText property, which allows you to provide ‘watermark text’ So, now you don’t need Watermark Textbox Control too.
Windows Phone Toolkit – Is In-Built!
From above code sample, you might have guessed that, DatePicker, TimePicker and such controls are newly added to the Windows Phone SDK. Previously available in Windows Phone Toolkit, many controls are now part of SDK. Just see the difference in Windows Phone 8.0 and 8.1 control set and you’ll get the picture
|Windows Phone 8.0||Windows Phone 8.1||8.1 Continued…|
So now, for basic controls you’re not required to depend on 3rd party libraries. There are some special cases though and I’ll talk about them in later posts.
Animations are very important to give fast & fluid feeling. They also provide feedback. Imagine you click on a button and you don’t feel that it is clicked! Windows Phone has some in built animations by default. But just like controls, Windows Phone Toolkit provided additional animations api for your apps. Now, with this release of SDK, those animations are also available to you, without depending on any libraries. For example some page transitions are available here. And below code can tell you how to use them.
Now, before ending this post, I would like to comment here that you can use this code (which is in Windows Phone app) in your Windows Store apps. Yes. The XAML is almost same for both kind of apps. So, you can share maximum XAML code with these platforms. Which also means, you get theming, animations, controls (DatePicker, TimePicker, etc…) in Windows as well. And you can just copy paste the code or do a file-linking. Below picture (from //build session) can give you more idea
These are all good additions. Now, with these additions there are some changes. For example, Panorama is gone and replaced with Hub control to align with Windows controls. Changes in how you access System Tray, etc. And we’ll talk about these changes in next part.
Till then… Happy Coding.