Adaptive UI in UWP XAML Andy Wigley

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Preface Demo A Quick Thank You How Did We Do It?
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
demo Default WANGPSLookup Default WANGPS.
Co- location Mass Market Managed Hosting ISV Hosting.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
demo.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Announcing Demo Announcing.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
travel Suru Windows 7 Release NET 4.0 / Surface 2.0 Release Multi-Touch Controls Multi-Touch API Surface Multi-Touch Controls & API Surface.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
WinHEC /22/2017 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Connect with life Connect with life
NEXT: Overview – Sharing skills & code.
demo Receive Inventory Export Parse and Normalize.
FonePlus Hugh Teegan Architect Mobile Devices Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
announcing Dev Manager Do I understand what we’ve built? Developer Can I bet on using this shared component? Testers What’s changed since I last.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
Windows 10 Adaptive Interface
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
MIX 09 11/24/2018 9:18 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Baseline: How Are We Doing Now?
Title of Presentation 12/2/2018 3:48 PM
1/3/2019 1:21 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Silverlight Debugging
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows 8 Security Internals
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
5/24/2019 6:44 PM 1/8/18 Bell #10 In a world governed by the gods, is there any room for human will? Do human choices make a difference? EXPLAIN © 2007.
Using Smart Unit Tests to find bugs earlier in the development cycle
日本初公開!? Vista の新機能を実演 とっちゃん わんくま同盟 7/23/2019 9:09 AM
Title of Presentation 7/24/2019 8:53 PM
5/6/19, Bell #6 12/11/2019 8:26 PM Explain the relationship between this picture and the events that took place in Chapter 7 in Animal Farm. © 2007 Microsoft.
Presentation transcript:

Adaptive UI in UWP XAML Andy Wigley Senior Developer Evangelist, Microsoft

Agenda How Windows makes adaptive UI easier What am I designing? Techniques to adapt Adaptive Tooling Visual State Triggers Relative Panel

How Windows makes adaptive UI easier

Windows 10 2-in-1s (Tablet or Laptop) Classic Laptop Desktops & All-in-Ones Phone Phablet Small Tablet Large Tablet Windows 10 Surface Hub Xbox Holographic IoT

Adaptive controls

Input intelligence

Scaling algorithm

Physical versus effective pixel 4” Phone 480x854 5” Phone 720x1280 6” Phone 1080x1920 4” Phone 480x854 5” Phone 720x1280 6” Phone 1080x1920

Ignore scale, resolution, & dpi. Design in Effective Pixels

What am I designing?

Small and Large Laptops Small and Large Desktop Monitors Planning your design Phone Viewing Distance: 16.3” Tablets and 2 in 1 Viewing Distance: 20” Small and Large Laptops 24.5” Small and Large Desktop Monitors 28” TV 84” 5” 8” 13”

Snap points phone phablet & tablet desktop limited landscape support epx 320 548 720 1024 phone phablet & tablet desktop limited landscape support one frame at a time 4+ actions on the bottom tabs are centered limited landscape support one frame at a time 4+ actions on the bottom single column stops scaling tabs are centered full landscape support two frames actions at the top one “…” visible - TBD tabs are left aligned Show search field if search was represented as an icon on smaller devices full landscape support three frames compact nav pane actions at the top one “…” visible tabs left aligned

The weather app

Adaptive techniques

Proportional layout with Grid 2* 1* auto 7* Rows/columns – 3 types of sizing: star sizing proportional: 1*/3* = 25%/75% auto sizing sized to content content can also have Max/Min widths and heights as limits pixel sizing hard-coded size – avoid in most situations auto 4* 1*

Proportional layout with Grid 600 1067 Grid auto 1* 400 711

Visual States Define differing XAML layouts Simplify animation Unique layout for distinct states Simplify animation Automatically implement state transitions Build in Blend Design and preview states and transitions

Visual state setters Setting a simple, scalar value Great when you think of ENUM values like Visibility, Stretch, etc Does not invoke a storyboard Does not require ObjectAnimationUsingKeyFrames <VisualState.Setters> <Setter Target="MyText01.FontSize" Value="24" /> <Setter Target="MyImage.Stretch" Value="UniformToFill" /> <Setter Target="MyImage.Height" Value="150" /> </VisualState.Setters>

Setting visual state in code VisualStateManager.GoToState(element, state, transition) public MainPage() { this.InitializeComponent(); this.SizeChanged += (s, e) => var state = "VisualState000min"; if (e.NewSize.Width > 500) state = "VisualState500min"; else if (e.NewSize.Width > 800) state = "VisualState800min"; else if (e.NewSize.Width > 1000) state = "VisualState1000min"; VisualStateManager.GoToState(this, state, true); }; }

Adaptive triggers Code-free state transition Two built-in triggers MinWindowHeight (Taller than this) MinWindowWidth (Wider than this) <VisualState x:Name="VisualState500min"> <VisualState.StateTriggers> <AdaptiveTrigger MinWindowWidth="501" /> </VisualState.StateTriggers> </VisualState>

Demo Visual States and Adaptive Triggers 5/8/2018 Demo Visual States and Adaptive Triggers © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

XAML's RelativePanel control A child or two act as a anchor elements They are relative to the panel Other children are relative to the anchors RelativePanel.Above = "ElementName" RelativePanel.RightOf = "ElementName" RelativePanel.Below = "ElementName" RelativePanel.LeftOf = "ElementName" RelativePanel simplifies adaptive UI A simple Visual State setter can rearrange the UI One element can move a family of related elements

Align with panel <RelativePanel> <Rectangle x:Name="RedRect" Height="100" Width="100" Fill="Red" RelativePanel.AlignHorizontalCenterWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True" /> <Rectangle x:Name="BlueRect" Height="100" Width="200" Fill="Blue" /> </RelativePanel>

Align with sibling (below, center) <RelativePanel> <Rectangle x:Name="BlueRect" Height="100" Width="100" Fill="Blue" /> <Rectangle x:Name="RedRect" Height="100" Width="100" Fill="Red" RelativePanel.Below="BlueRect" RelativePanel.AlignHorizontalCenterWith="BlueRect" /> </RelativePanel>

5/8/2018 Demo RelativePanel © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

XAML Views XAML page that ‘inherits’ the code-behind of a parent page Used – rarely! – to provide per-device customisations

5/8/2018 Demo XAML views © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Developers have many tools to build an adaptive UI

Ne zaboravite ispuniti upitnike. Čekaju vas vrijedne nagrade!