Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows 8 App Development with XAML

Similar presentations


Presentation on theme: "Windows 8 App Development with XAML"— Presentation transcript:

1 Windows 8 App Development with XAML

2 New version coming soon!
Updated for Silverlight 5 Over 115 recipes (that’s 30 extra!) Extended to about 700 pages (that’s 250 extra!) Covering WP7, MVVM, RIA Services and much more! More info:

3 This is the road to development on Windows 8
In this part... Styling and templating Data in your Windows 8 apps Getting data Data binding The Application Lifecycle (Copyright 2010 Windows Phone 7) Tiles and more (Copyright 2010 Windows Phone 7) IO’ing in Metro apps

4 This is the road to development on Windows 8
Covered in Part 1... General XAML stuff for Windows 8 Old and new controls Finding your way with navigation See for the recording!

5 Default styles Project templates provide great starting point for Metro style Default styles are included Familiar XAML styling and resource dictionaries Works in the same way Dark and light resource dictionaries

6 Dark and light themes Controls are styled by their control template
Resource Dictionaries containing dark and light styles Dark styles are default Recommended for media apps, such as photos or video generic.xaml Light styles can be switched to quickly Recommended for text-based apps light_generic.xaml

7 Get your style right! Windows 8 provides great controls through the platform (we’ve seen that earlier) Controls can be styled, breaking down their parts Properties Set foreground color to blue Templates Change the structural appearance of a control Visual States Define how a control looks in a specific state

8 Styling remains the same as well...
Explicit styles (keyed) Apply the style to the target when requested by key name Great for unique styles BasedOn styles Inherit from an explicitly keyed style Implicit styles Apply the style to all instances of the TargetType Ideal for app wide styling of a control type

9 Templating in Windows 8 Metro style look and feel
Change the control to suit you Properties Visual States Content

10 Visual State Manager (again)
Visual states give controls (and your app) a great feel Define your app’s behavior Change appearance Transforms Easing KeyFrames Animations

11 Working with data is similar to Silverlight and WP7
It involves Getting data Working asynchronously Using the data Binding Parsing ...

12 Getting data Working with services is preferred in most cases
Relational databases should be behind a service Local app storage App has its own storage directory Can access local file system

13 Supported service scenarios
Use XML-over-HTTP JSON-over-HTTP ASMX Web Services Sockets oData (no RIA Services at this point )

14 Working async gets easier
await keyword makes things easier Doesn’t block UI thread Doesn’t require the ugly Dispatcher.BeginInvoke(() => …);

15 Now what to do with the data?
LINQ is fully supported Data binding to controls We saw a lot of new controls Old controls support data binding as well  Optionally grouping the data

16 Data binding Data binding is the infrastructure that links properties of controls with properties on your data objects Can be done in XAML or via code Binding actions enable customization of the binding logic Value converters Binding modes OneWay, TwoWay, OneTime All this stuff remains the same as it was before! Not everything that is supported in data binding in WPF, SL and WP7 is currently supported Might change Currently SL4 options are supported more or less

17 Data templates Enables re-usable declarative XAML to define data binding behavior and presentation Can define the template for the panel in which the contents will appear Can define the template for the items themselves

18 Application lifecycle
Running App Suspending Suspended App Terminated App Low Memory Resuming

19 When the app is about to be shut down
OnSuspending event on app object is your chance Understanding user’s intentions for save Utilize familiar serialization mechanisms available in XAML Metro style apps

20 Suspending and saving //SuspensionManager.cs can be found in SDK Samples async protected void OnSuspending(object sender, SuspendingEventArgs args) { SuspendingDeferral deferral = args.SuspendingOperation.GetDeferral(); await SuspensionManager.SaveAsync(); deferral.Complete(); }

21 Resuming the application
Resuming event on app object App still lives in resident memory Scenarios around rehydrating live data Activating an app Provide content to your Window Determine PreviousExecutionState for lifecycle management Navigate your app to desired view based on activation type Activate your Window to dismiss Splash screen

22 Activation events OnLaunched OnSearchActivated OnSharingActivated
User invokes app from Tile or Notification OnSearchActivated User selects your app from search pane OnSharingActivated User selects your app from share pane OnFilePickerActivated User selects your app via FilePicker to select files from OnFileActivated User selects file your app has a registered handler for

23

24 You all remember tiles from WP7?
Represents the app while not active It’s a view in the application that engages the user Can be updating and alive with activity Easy to create and update! Draw users back into your app over and over

25 2 types of tiles: regular ones
Tap on tile to launch or switch to an app Static default tile specified in app manifest Two sizes: Both sizes can have live updates Square (1x1) Wide (2x1)

26 2 types of tiles: Live tiles
Tiles updated using pre-defined templates Templates provide rich rendering options Text-only, image-only or combination JPEG or PNG only, max size 150 KB Local or cloud updates Can even use the Push Notifications

27

28 Badges Overlays status on top of tile Supports square and wide tiles
Number up to 99 or pre-defined glyph: Always legible on top of images Badge Badge

29 Secondary tiles Tiles created by “pinning” content from app
Pin initiated by app via simple runtime call User confirms pin operation via system UI Exposes a personalized surface for app Same capabilities as app tiles Launch leads to relevant content

30 Can I touch your file please?
Metro apps are more or less like Silverlight when it comes to storage Files can be App data (specific for the application) Local on the machine On a device or a network On the web Depending on the location, different restrictions and access model are in place

31 App data Your Metro app has FULL access on its local folder:
C:\Users\<user_name>\AppData\Local\Packages\<packag e> Can create, delete, modify… files Accessible via ApplicationData.Current.LocalFolder

32 Library access If your app wants access to a library on the device, it needs to specify this in the manifest Forget this to get an System.UnauthorizedAccessException Music, Picture and Video libraries: nothing extra needed Documents Library: also requires filetypes to be specified

33 I need to access C:\temp
Sorry, no can do! Only accessible via the FilePicker API Remember, about the same in Silverlight

34 Thank You


Download ppt "Windows 8 App Development with XAML"

Similar presentations


Ads by Google