Post on 16-Jul-2015
transcript
What’s New In
Xamarin.Forms 1.3
Craig Dunn
craig@xamarin.com
What’s new in 1.3?
1. New App class
2. Font Properties
3. Styles
4. Triggers
5. Behaviors
6. Navigation Stack
and a lot more…
New Application Class 1/2
• MainPage property
• Can be expressed as XAML
• Provides a shared ResourceDictionary for the entire app
Styles!
The old way The new way
Application base
set MainPage
New Application Class 2/2
• Application lifecycle:
OnStart
OnSleep
OnResume
• Properties dictionary (persists across app re-starts)
NOTE: beware of existing App class in Windows Phone projects.
Font refactoring
• The deprecated Font property was difficult to databind (face, size, style too tightly coupled)
• Replaced by:
FontFamily
FontSize
FontAttributes
• Use GetNamedSize() to resolve NamedSize enum
Styles 1/3
• You could previously add objects to a ResourceDictionary, and reference with {StaticResource}
The old way
Styles 2/3
• You could always add properties to a ResourceDictionary, and reference with {StaticResource}
• Now you can group into a Style and share!
• Can also be added to App-level ResourceDictionary
Styles 3/3
• DynamicResource behave like data-binding, and support Apple’s Dynamic Type (size) rendering
• Triggers & Behaviors can be added to styles
Triggers 1/3
• Visual Elements can react to events and property changes
• “conditional style” - CP
• Can be added in C#
• Types:
Trigger
EventTrigger
DataTrigger
MultiTrigger
OR
OR
Triggers 2/3
• The EventTrigger has Eventinstead of Property
• TriggerAction is written in C#
• Remember xmlns:
Triggers 3/3
• DataTriggers can bind to other controls (Binding instead of Property)
Behaviors 1/2
• Add functionality to visual elements without subclassing
Behaviors 2/2
• Add functionality to visual elements without subclassing
• Can participate in data-binding
Navigation Stack
• Allow editing of the stack beyond push/pop off the top
• New features:
RemovePage
InsertPageBefore
NavigationStack[]
• Animation can be disabled!InsertPageBefore
RemovePage
Push/Pop
Other highlights
• Page.OnBackButtonPressed to allow intercepting physical back button
• Map.Pin response to Clicked after bubble is displayed
• Star (*) is the default grid size
• ListView has context-actions (eg. side-swipe buttons in iOS)
Release Notes:
http://forums.xamarin.com/discussion/29934/xamarin-forms-1-3-0-released/p1
• MasterDetailPage now has
ShouldShowToolbarButton
MasterBehaviour
• iOS 64-bit support
see the release notes for more!
Questions?
Craig Dunn
craig@xamarin.com
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/
https://github.com/xamarin/xamarin-forms-samples
WorkingWith Fonts, Styles, Triggers, Behaviors, Navigation