XAML and Direct2 or Direct2D
In this case we will use the template provided with Visual Studio, this template is not found in the C# nor the VB template library. In this case we are using the term template as in Document Template and not the C++ template.
The template isn’t all that easy to use if you are not a C++ wonk, so let’s take a look at it and add a viewport to it to show your interesting app
In C++ open the Direct2D App (XAML) as highlighted below:
Make a quick mod to the XAML
You HATE XAML? Well of course you do, if you are a student the professors have been teaching you Forms for the past 7 years when XAML has been taking over the UI on Windows. To show you how easy it is to use XAML, run your app and then snap it (ok, I changed the C++ phrase, not important right now, don’t get focused on that), but I changed the XAML to better demonstrate the snap effect:
So it looks like this:
And when snapped it looks like the following (the snap is on the left side of image, ignore the Visual Studio for now), note that we only see the words for one, two, three, and none of the other number words:
Now let’s add a Viewbox, not Viewport which is a keyword in XNA, not here, Viewbox, keep in mind that Viewbox can hold only one XAML thing, but that thing could be a grid that holds other things, in this case there is only a single textblock so you can use the Viewbox with that single thing.
Now try the snap:
Now you see the number words between one to eleven in tiny font. Not necessarily what you want, but it does what I want: Shows you how to use the Viewbox.
Wait a minute, what about the C++ Generated text? Why did that happen, well that is a story for another time. 🙂