Microsoft TechDays 2013 Basel

Thanks to all who joined my sessions at TechDays in Basel. Also a big thanks to Microsoft Switzerland for organizing this great and successful event. I really enjoyed the two days of networking with awesome people.

Please find the slides and demos of my talks on my homepage by (more…)

It’s there: Windows Store Apps with XAML and C#– the ultimate handbook

Wow, it’s done. The ultimate handbook about Windows Store Apps with XAML and C# is printed and available. You can order your copy of the German-written 1146-pages-book on amazon:

Amazon.de: Windows Store Apps – das umfassende Handbuch

Find more information about the book on amazon, on my homepage http://www.thomasclaudiushuber.com/windowsstoreapps and on the publisher’s website on www.galileocomputing.de/3196.

Training on Windows Store Apps

In Germany, Switzerland and Austria I’ll give a three-day-training on Windows Store Apps. If you or your company have interest on this professional training, directly contact me via http://www.thomasclaudiushuber.com/contact.php. It is possible to train you in the Trivadis-Trainings centers or onsite at your office.

So far so good, let’s look at the past and the future

The past

Puh, this was year was really instensive. Here the straight plan I had so far:

  • January: Buy new home
  • February: My second daughter Sara was born.
  • March: Finish the manuscript for the book
  • April:Renovate and improve new home (thanks to Makita Zwinkerndes Smiley)
  • May: Move
  • … in all months: Working as a consultant and trainer @Trivadis.

The future

So the future contains much more spare time, it’s necessary, because I say “Time is money is not true, time is unpayable”. I want to spend as much as I can with my kids, my wife, family and friends (See also this awesome post from Tim on that topic). So the future plan looks like this:

  • June: Finish a WPF-project as a consultant and enjoy the free weekends
  • July: Parental leave Smiley
  • August: Parental leave Smiley
  • September: Back to work, speaking at basta (www.basta.net) and at Trivadis-internal TechEvent

Keep on rockin’
Thomas

Dragging Elements in Windows Store Apps

In Windows Store Apps there are three kinds of Touch-Events:

  • Gesture Events – those are high-level-events like Tapped or RightTapped.
  • Pointer-Events – low-level-events like PointerPressed, PointerMoved, PointerReleased.
  • Manipulation-Events – low-level-events for multi-touch actions like rotate, scale or transform an element.

Pointer-Events consolidate Touch-, Pen- and Mouse-Input. So on the UIElement-class from WinRT you wont find Mouse-Events known from WPF/Silverlight like MouseLeftButtonDown.

In my upcoming Windows Store Apps I want to show how Elements can be dragged/moved with Pointer-Events. You can download the code of the sample here:

MovingElements, or in German ElementeVerschieben-Sample

The app looks like below. By touching an empty space in the yellow area, an Image is inserted. The image can be grabbed with a finger or with the mouse-cursor and moved around. The app works also with multiple fingers. You can grab multiple images at once and move them around.

MovingElementsWinRT

If you´ve feedback to the code, feel free to comment. Smiley 

As I´m really busy the next weeks/months with the writing of the Windows Store Apps-book, I´m not able to give you big support on the code. Use it or not.

Thomas

Windows Presentation Foundatoin 4.5 – WPF 4.5 – the 3rd edition is here

I’m proud to announce that the ultimate handbook about Windows Presentation Foundation (WPF) in .NET 4.5 is in stores now. Order your copy of the German-Speaking Topseller about WPF directly here on Amazon:

Order WPF-Book on Amazon.de

Find all the Details about the book on www.thomasclaudiushuber.com/wpf

Currently I’m working really hard on my book about Windows Store Apps. It’ll be released next year and can already be preordered on Amazon:

Preorder Windows Store Apps-Book on Amazon.de

So maybe I’ll blog more again in the future. But for now I’m totally focused on finishing the Windows Store Aps-book.

So far so good,
stay tuned,
Thomas

Microsoft TechDays – WinRT-Controls Deep Dive: FlipView, ListView, GridView & SemanticZoom

Danke für die zahlreiche Teilnahme an meiner Session zu den WinRT-Controls zum Entwickeln von Windows Store Apps. Es war eine Level 3 (von 3) Session. Wie versprochen sind die Slides und Live-Demos unter folgendem Link verfügbar:

www.thomasclaudiushuber.com/talks.php

Bei Fragen, Feedback, Lob und Kritik einfach eine E-Mail an mich:
Mail an Thomas

Thomas

SwissBUILD – Kostenfreies Event mit Microsoft und Trivadis rund um Windows 8 & Co.

Am Dienstag, 30. Oktober 2012, veranstalten Microsoft und Trivadis in Glattbrugg (Zürich) ein kostenfreies Event rund um Windows 8, Windows Store Apps & Co. Allerdings sollten Sie sich für eine Anmeldung beeilen, da die Anzahl der Teilnehmer beschränkt ist.

Nach Vorträgen von Ken Casada (Microsoft) und mir werden wir uns die Keynote der BUILD-Konferenz im Live-Streaming ansehen. In einer Podiumsdiskussion mit Experten von Microsoft, der MSUGS, der Trivadis und der Fachzeitschrift Netzwoche diskutieren wir anschliessend, was die Ankündigungen der Keynote für die Praxis bedeuten. Zum Abschluss findet unter allen Teilnehmern eine Verlosung statt.

Hier die Fakten zum kostenfreien Event:
Datum: Dienstag, 30. Oktober 2012
Zeit: 16:00 – 21:15 Uhr
Ort: Trivadis Zürich, Europa-Strasse 5, CH-8152 Glattbrugg

Weitere Details zum zeitlichen Rahmen, zu den Vorträgen sowie einen Link zur Anmeldung befinden sich auf folgender Seite:
http://www.trivadis.com/events/m-build-live.html

Windows Store is now open for all developers in 120 countries

Microsoft’s new marketplace for Windows-Apps – called the Windows Store – is open for all developers since yesterday. Before only a limited amount of developers and companies have been able to register for app submission. Now every individual can register to the Windows Store and submit Windows Store-apps.

Read more on the Windows Store for developers-blog

In the blog-post on the Windows Store for developers-blog Microsoft also announced that certain Microsoft Developer Network (MSDN) subscribers will get a free one-year developer-account for the Windows Store. If you don’t have a MSDN-subscription, you’ve to pay a small fee.

To create your developer-account and submit your Windows Store-apps to the Windows Store, go to the windows-developer-portal on http://dev.windows.com. In the developer-portal click on “Windows Store-apps” like shown in the screenshot below:

By clicking the link you navigate to the portal for Windows Store-apps, also directly accessible via http://dev.windows.com/apps. In that portal just click on “Dashboard”:

After the click on “Dashboard” you are prompted to sign in with your live-id. With a wizard-like approach you can create your developer-account there and manage your Windows Store-apps.

Have fun. :)

The naming issue: Metro Style-Apps, Windows 8 Style-Apps, Modern UI-Style Apps or Windows Store-Apps?

This post is part of a series about creating Windows Store-apps with XAML and C#. Find the Content of the series here:
Windows Store-apps with XAML and C# blog-series

Through the past weeks there’ve been many names around for the apps running in the new tile-based User Interface of Windows 8. This blog-post tries to clarify about the different names and what the apps are called now.

In the beginning of the Windows 8 Preview era those apps running in the new tile-bases UI have been called Metro Style-Apps, and the whole new tile-based UI was called the Metro UI. Some days before Windows 8 went RTM, there was an issue with that name, because a German company reselling technical stuff like computers etc. already got the name Metro AG. Metro AG owns “Saturn” and “Media Markt”, two of the biggest hardware-resellers in Germany. And the management of the Metro AG was not happy with the usage of their name for Microsoft new tile-based UI. But the Metro AG never gave an official statement on that topic. Microsoft knows that the Metro AG is important for them, and they just said: “Metro was just a Codename”. Dot. If you’ve started with Windows Phone 7, you probably know that the tile-based UI was introduced there and was called Metro. So this “Metro was just a Codename” statement is not the whole truth, but that’s all Microsoft said. Seems like no-one want’s to produce big waves. In fact, shortly before the RTM Version of Windows 8 Microsoft had to avoid any long-running legal fights, so I think that’s one of the biggest reasons for the simple silent “Metro was just a Codename”-statement.

After the name Metro was dropped, Microsoft said, that developers shouldn’t use the name Metro anymore. Even Apps for the Windows Store will fail certification if they contain the name Metro. I’m not sure what will happen when Metro AG places an App in the Windows Store. :-)

OK, so the name Metro was dropped. The problem for developers, writers and all people talking about the new apps was that Microsoft didn’t provide a new name. Temporarily they called the apps Windows 8 Style-Apps or just Windows 8-apps. That was a bad idea, because when there’ll be a Windows 9 the apps for the tile-based UI will be called Windows 8-apps?! Not so good. This was recognized soon and there has been another name around for the tile-based UI: Modern UI. The new tile-based UI was just called the Modern UI, and the apps that run in that UI were called Modern UI-Style apps. But Microsoft also never officially confirmed that. Due to this naming-issue some developers called their apps just WinRT-apps, because the apps make use of the new object-oriented Windwos API called WinRT (Windows Runtime).

When the RTM version of Visual Studio 2012 came out in the mid of august 2012, the first thing I did was to look how Microsoft has named the apps for the Modern UI in the “New Project”-Dialog of Visual Studio 2012. I was really curious about that. And what a suprise, there was another name: Windows Store-apps. And that’s the name how we developers should call the apps today.

On the developer-portal (http://dev.windows.com) microsoft had still the name Metro. Since last week there’s also the new name Windows Store-apps. Even in the forums they are now talking no more about Metro Style-apps, but about Windows Store-apps (http://social.msdn.microsoft.com/Forums/en-US/category/windowsapps). That’s a statement from Microsoft that they will keep this name for the future. Yes.

So, let’s wrap it up:

  • Modern UI
    the tile-based surface in Windows 8 and in Windows Phone 7/8.
  • Windows Store-apps
    apps that run in the Modern UI on a Windows 8 PC/Tablet are sold over the Windows Store and so they are called Windows Store-apps.

It’s just as easy. :)

Windows Store-apps: WinRT XAML vs. Silverlight XAML

This post is part of a series about creating Windows Store-apps with XAML and C#. Find the Content of the series here:
Windows Store-apps with XAML and C# blog-series

Last weekend I’ve finished the XAML-chapter of my upcoming book about developing Windows Store-apps with XAML and C#. I want to share the things that you should know about the WinRT XAML – the way I call it here – if you’re familiar with Silverlight or WPF.

The WinRT XAML is much like the XAML we know from Silverlight. But there are some differences in WinRT XAML:

  • the way you use your custom namespaces is different
  • there are some missing things (TypeConverters, Custom MarkupExtensions)

Let’s look at the two parts

Use custom namespaces

There are two ways in XAML to use a namespace:

  • 1:1-Namespace-Mapping
  • 1:n-Namespace-Mapping

Read the difference for both in Silverlight- and WinRT-XAML below.

The 1:1-Namespace-Mapping

Let’s assume you’ve the following class:

namespace UIRocker.Special
{
  public class WindowsEight
  {
    public bool IsGreat { get; set; }
  }
}

To use this class in Silverlight-XAML, you’ve to add an Namespace-Mapping like this

xmlns:rocker="clr-namespace:UIRocker.Special"

or like this if the CLR-Namespace is in another assembly than the XAML-file containing the Namespace-Mapping below: 

xmlns:rocker="clr-namespace:UIRocker.Special; assembly=UIRockerLib"

With the Namespace-Mapping the classes from that Namespaces can be used with the chosen alias. The alias is “rocker” in the snippets above, so the WindowsEight-class can be used as below:

<rocker:WindowsEight IsGreat="True"/>

In WinRT-XAML you’re using the class in the same way as above, but the way of creating the Namespace-Mapping is different. Instead of using the syntax with “clr-namespace…” you use:

xmlns:rocker="using:UIRocker.Special"

You don’t care if the Namespace UIRocker.Special is in another assembly as the XAML-file or not. This works exactly the same way as the using-directive in C#, where you also don’t care if the Namespace is in another assembly than the .cs-File or not. So, great improvement, but creates a little incompability with Silverlight-XAML.

The 1:n-Namespace-Mapping with XmlnsDefinition-Attribute

The Namespace-Mappings above have been 1:1-Mappings. One XML-Namespace was mapped to one Silverlight/WinRT-Namespace.

In Silverlight-XAML you can create a 1:n-Namespace-Mapping by placing the XmlnsDefinitionAttribute (Namespace: System.Windows.Markup) on your assemblies like this:

[assembly: XmlnsDefinition(
 "http://thomasclaudiushuber.com/","UIRocker.Special")]
[assembly: XmlnsDefinition(
  "http://thomasclaudiushuber.com/", "UIRocker.Mvvm")]

Classes out of the Namespaces UIRocker.Special and UIRocker.Mvvm can be used in XAML with one alias by making a 1:n-Namespace-Mapping like this:

xmlns:rocker="http://thomasclaudiushuber.com/"

Unfortunately in WinRT-XAML there is no possibility for a 1:n-Mapping. The Namespace Windows.UI.Xaml.Markup contains a XmlnsDefinition, but it’s not an attribute, it’s a struct and therefore not usable.

Especially when you create a library with many Namespaces in it, it’s great to use just one alias for the library in XAML. Maybe the next Version of WinRT will contain such a mapping. By the way, first versions of Silverlight also didn’t support 1:n-Namespace-Mappings.

Missing things in WinRT-XAML

There are a few other things that are not in WinRT-XAML or behave differently. Let’s take a look at them.

Typeconverters

As XAML is XML, every Attribute contains a string-value. This string-value needs to be converted into the value of the property-type the attribute represents. For primitive types like double, float, int, bool, char etc., the conversion automatically is done by the XAML-Parser (Silverlight and WinRT). Also for Properties of type enum, the XAML-Parser tries to convert the specified string-value into the enum-type of the property. There is also a conversion for some central types hardcoded in the XAML-Parser of Silverlight and WinRT, e.g. the Brush-Type. This conversion allows you to assign a string in XAML where a Brush-Instance is required:

<ListBox Background="Red">

The XAML-Parser takes the “Red”-string, creates a SolidColorBrush with the Color Red and assigns it to the Background-property of the ListBox.

(Excourse to WPF-XAML: In WPF-XAML this conversion is not done by the XAML-Parser, it is done by the BrushConverter-class)

Now if you have properties that are of your own type, let’s look at this works in Silverlight and WinRT. Let’s assume we have the classes below:

public class Person
{
  public Address Address { get; set; }
}
public class Address
{
  public string City { get; set; }
  public string Country { get; set; }
}

In Silverlight-XAML, it is possible to create a Person-instance as below if a TypeConverter for the Address-type exists:

<local:Person Address="Müllheim Germany"/>

The corresponding typeconverter could look like this:

public class AddressConverter : TypeConverter
{
  public override bool CanConvertFrom(...Type sourceType)
  {
    if (sourceType == typeof(string))
      return true;
    return base.CanConvertFrom(context, sourceType);
  }
  public override object ConvertFrom(...object value)
  {
    if (value != null && value is string)
    {
      var array = value.ToString().Split(' ');
      if (array.Length != 2)
        throw new ArgumentOutOfRangeException(
          "Invalid format for address");
      return new Address
      {
        City = array[0],
        Country = array[0]
      };
    }
    return base.ConvertFrom(value);
  }
}

The only thing that is additionally required is to tell the XAML-Parser where to find the AddressConverter. You do this by specifying the TypeConverterAttribute either on the Address-Property in the Person-class or on the Address-class itself. Below an example that specifies it on the Address-class.

public class Person
{
  public Address Address { get; set; }
}
[TypeConverter(typeof(AddressConverter))]
public class Address
{
  public string City { get; set; }
  public string Country { get; set; }
}

So far to Silverlight-XAML, now let’s look at WinRT-XAML. As mentioned above, WinRT-XAML also supports conversion for

  • primitive Types like bool, char, double, int, float,…
  • enumeration-values
  • central types like e.g. the Brush-type.

If you’ve custom types like the Address-class, currently there’s no support. There’s no TypeConverter in WinRT. Dot.

Markup-Extensions

In Silverlight-XAML it’s possible to create custom subclasses from MarkupExtension and use them in XAML with curly braces. WinRT doesn’t support custom Markup-Extensions. Dot.

Did you find out other bigger differences about XAML?

See you next week with the next post about WinRT and Windows Store-apps.

Thomas