Apr 072014
 
 April 7, 2014  Posted by at 5:31 am Windows, WinRT, WP Tagged with:  Add comments

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.

universal_apps

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.

UniversalApps

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

UniversapAppsNavigationMenu

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

universal_apps2
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.

snap_to_guides

snap_to_guides2
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 🙂

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 5 + 6 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)