windows 10 uwp tips and tricks for developers

33
Windows 10 UWP tips & tricks for developers. Darius Pauliukevičius

Upload: darius-pauliukevicius

Post on 15-Apr-2017

70 views

Category:

Documents


0 download

TRANSCRIPT

Windows 10 UWP tips & tricks for developers.Darius Pauliukevičius

Use MVVM

Typical Parts of a full MVVM Solution

View ViewModel

Model

Services

VM Locator

Service Locator

TestsUITests

Commands

Binding

Method Invoke

Messaging

Events

A highly testable and well-architected application!

bonus!

Responsive Design

Breakpoints

Adaptive state triggers

Demo

Optimize XAML

Load only what you need• Don’t put all your resources in App.xaml.• Don’t load heavy dictionaries to use only one

resource.

Reduce layout structureMinimize element count

Minimize overdrawingDebugSettings.IsOverdrawHeatMapEnabled

Ensure your text is on the fast pathDebugSettings.IsTextPerformanceVisualizationEnabled

In Windows 10, text rendering is 50% faster

Delay element instantiationx:DeferLoadStrategy

Demo

Optimize images

Image rendering optimizationLet API return images with appropriate dimensions.or useDecodePixelWidth and DecodePixelHeight

Use Virtualization

List virtualizationRealize only visible items+a little bit more

Is on by defaultEasy to break it

Incremental list loadingImplement ISupportIncrementalLoading

Demo

Optimize data bindings

x:BindHeavy lifting done at compile timePerformance boostx:Bind is validated at compile time

Test RELEASE build

.NET NativeWindows 10 Release build compiles IL binaries into native binaries.Up to 60% improvement in startup.

Release build behavior might be different.

Use adaptive live tiles

Adaptive Live tileFull flexibility on how content is displayed on the Live Tile.

XML declaration

Notifications Visualizer (https://www.microsoft.com/en-us/store/apps/notifications-visualizer/9nblggh5xsl1)

Adaptive live tile from serverStartPeriodicUpdate or StartPeriodicUpdateBatch TileUpdateManager.CreateTileUpdaterForApplication()

Secure your API

Certificate validation chainAdd certificate to app and set exclusive trust.It will create new app certificate validation chain.

Useful librariesWinRT XAML Toolkit(https://github.com/xyzzer/WinRTXamlToolkit)

MyToolkit(https://github.com/MyToolkit/MyToolkit)

Template10(https://github.com/Windows-XAML/Template10)