Principal Program Manager Xamarin University @marksm github.com/markjulmar
Agenda • Intro to Visual Studio Tools for Xamarin • Mobile UI approaches • Shifting to mobile APIs • Consider the User Experience • Resources and Q & A
from a shared code base
Visual Studio for Windows or Mac .NET Languages .NET Libraries
If you’re a .NET developer, you can build native mobile apps
3 native UI definitions Shared App Logic Shared C# Logic Windows C#Android C#iOS C#
Shared C# Logic Windows C#Android C#iOS C# Shared UI definition Single shared UI definition Shared App Logic
90s 2002 2006 2011 2015 * Green doesn't mean "simple,” it means that the frameworks have the most in common
2006 2011 2015
Talks to a web service Parses a data format Performs processing or logic Uses a database
Accesses system information Uses files and folders on the device Accesses personal information Uses external devices
App Singleton Data Binding Behaviors Implicit and Explicit Styles Data Templates Data Triggers Property Triggers XAML Layout Model Designed for MVVMAnimations
Xamarin.FormsUWP
<Label Text="Text={Binding Source={StaticResource resourceKey}, Path=PropertyName, Mode=OneWay}" Source Target Any Object Any public property BindableObject BindablePropertyBinding label.SetBinding(Label.TextProperty, new Binding("PropertyName", source: someObject));
this.DataContext = new MainViewModel(); this.BindingContext = new MainViewModel();
Text={Binding ElementName=otherControl, Path=Text} Text={Binding Source={x:Reference otherControl}, Path=Text}
Layout containers organize children "Measure and Arrange" layout algorithm Can create custom panels for unique requirements
WPF / UWP Xamarin.Forms Layout Style StackPanel StackLayout Left-to-right, or top-to-bottom infinite stacking Grid Grid Tabular format (rows and columns); Xamarin.Forms does not support dynamic splitting DockPanel n/a Dock to edges of window Canvas AbsoluteLayout Pixel/Coordinate positioning WrapPanel n/a Wrapping stack RelativePanel RelativeLayout Relative rule-based positioning UniformGrid n/a Provides a tabular grid of uniform size ScrollViewer ScrollViewer Provides scrolling container for content
WPF Xamarin.Forms Layout Style Horizontal Alignment Horizontal Options Align an element to left/start, center, or right/end of the parent container VerticalAlignment VerticalOptions Align an element to the top/start, middle, or bottom/end of the parent container Margin Margin Add spacing on the outside of an element Padding Padding Add spacing to the inside of an element n/a Spacing Property exposed by layout containers to provide spacing around each child contained in the panel
ctor resumed suspended
Content Page Master Detail Page Navigation Page Tabbed Page Carousel Page
Editor Map Slider EntryCell ActivityIndicator Entry OpenGLView Stepper ImageCell BoxView Image Picker TableView SwitchCell Button Label ProgressBar TimePicker TextCell DatePicker ListView SearchBar WebView ViewCell More to come
Label Renderer Label Renderer Label Renderer TextView TextBlock Cross-platform Platform-specific iOS Android Windows
StackLayout stack = new StackLayout(); #if __IOS__ var segmentControl = new UISegmentedControl { Frame = new CGRect(20, 20, 280, 40) }; segmentControl.InsertSegment("One", 0, false); segmentControl.InsertSegment("Two", 1, false); segmentControl.SelectedSegment = 1; segmentControl.ValueChanged += async (sender, e) => { var id = (sender as UISegmentedControl).SelectedSegment; await MainPage.DisplayAlert( $"Native Segmented Control Clicked {id}", "Whoa!!!!!!", "OK"); }; stack.Children.Add(segmentControl); #endif
Embrace minimalism • Simplify: what are users’ core tasks? • Avoid multiple information columns • Design each screen to do one thing
material.io/guidelines/material-design/introduction.html developer.apple.com/design/ docs.microsoft.com/en-us/windows/uwp/style/
Steven Hoober , UX Matters Images: Stephanie Walter
Do you want to close it? Wait OK Embrace async
Embrace vector graphics • Use properly sized images • Include multiple sizes, based on the supported device form factors • Prefer vector formats (.svg or .pdf)
developer.xamarin.com/guides/cross-platform/advanced/accessibility/
Pew Research Center, 2015 Global Web Index, 2016 Think with Google, 2016 66% have multiple devices 21% use them concurrently
Fragmentation Unreliable networks User interaction Limited resources Interruptions and constant use
Tap, Double Tap, Long Press Swipe and Scroll Hardware Buttons (Back and Menu buttons) Enter Text Clear Text Capture Screenshot
mobile.azure.com
aka.ms/buy-xamarin-university
• Slides and Demos github.com/markjulmar/desktop-to-Xamarin • Create your free Visual Studio Mobile Center account mobile.azure.com • Register an account and access free training resources university.xamarin.com • More documentation developer.xamarin.com/desktop
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin

Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin