Iris Classon
Iris Classon - In Love with Code

Build XAML Converged Apps: Notes BUILD 2014

Notes from: Using Visual Studio to Build XAML Converged Apps by Navit Saxena

Notes from: Using Visual Studio to Build XAML Converged Apps by Navit Saxena

I’m skipping the no shit Sherlocks in the session (-remember to check that the UI looks good on both platforms etc.)

You can still select WP8.1 only templates, or WP SL.

Under the Universal Apps node you have two options, blank app or hub app.

The hub template is a good way to see how the code and assets can be structured

When you create an universal app you get a solution folder with three projects inside it. The Windows 8.1 and WP8.1 are the platform specific projects while the shared folder is the shared code, assets and more. The files there get automatically imported to the platform specific projects. Notice reference added under each References node.

What can be shared
Most file types are supported. If you select add new item you can see that quite few different file types are supported.

Scale factors differ between the two platforms so it might be better to have the scale folders in the specific project (comment by me: in another session they said the opposite so I guess its really up to how you want it).

With an existing project
To add a shared project right click on solution and add WP project. Accept changes.
This adds a WP project and shared project.
Move over files from Windows store app to the shared project. Go through the files and evaluate what makes sense to share and what doesn’t make sense. Build the solution and use the errors as a guide to make necessary changes.
Under properties and build under the platform specific projects you will see the symbols you can use for conditional compilation. Keep it as it is or change it. You cab use #if #endif conditional compilation when the code for implementing a certain function or accessing certain namespaces.

Designer

The designer window has a navigation bar that helps you navigate in your XAML code. Switching context enables intellisense for that context.

Blend supports Universal Apps but does not have the navigation bar, use the device window instead to switch context. Everything else is supported.

Intellisense will let you know when you are adding code that will only work on one platform with a warning as you are typing.

Shared Projects do not have a binary output, its just a container.

Class Libraries
If you need to target many different platforms
PCL lets you share a binary between as many platforms and projects as you want. While Shared Projects are new PCLs are not, they are however improved.

Under PCL properties you can change the platforms you are targeting. API access will be limited to the most limiting project targeted.

PCLs do not support hashed conditional compilation, so handling platform differences with some sort of abstraction.

VS extension coming soon
VS extension will let you use Shared Projects in PCLs. The VS extension will be found on VS Gallery (-comment: I’ll add a link when that is up).

XAML authoring features
These have existed in win8.1 but now alao exist in WP.

Intellisense for resources- when setting static resource suggestions for available styles for that element will be shown.
Intellisense for bindings
Suggestions for bindings as for resources.

F12 go to definition support in XAML for basically anything.
For example binding properties, style resources, user controls, types and more.

Device Panel Support


WP8.1 support a rich collection of devices. Use the device panel to adjust design at design time.
You can change device, resolution, accent, theme, contrast and more. This saves you a lot of time as you don’t have to run the emulator, go to settings, make changes, test app and so on.

In Blend - Features
Rulers and Guides
You create a guide by pulling one from top or right and set it to desired measure to create a wireframe. Once you have it, you can go to view, guides and save the guides. This can then be imported.

So what do we do with the guides? Well, you can enable snap to guides wich will let items snap to the guides.
And that was that :)

Comments

Leave a comment below, or by email.


Last modified on 2014-04-07

comments powered by Disqus