Yippee just wrote my Hello World XAML/C++ app, now I am an expert at WinRT!

After spending most of the last 20 years looking for the intellisense after I hit a period, the XAML/C++ was a bit of surprise, not much though.  It isn’t clear how this works unless you have worked through the SimpleBlogReader.

Here is what I did to create my Hello World app using XAML and C++, thank goodness that the presentation layer is soooo much better!

To get started, and I am doing this screen by screen, here is my initial starting of Visual Studio 11 Bet Express for Windows 8, I am also showing the exact version I am running, in the future, if you come across this blog, you will know that this is the Beta and what version.\

 

Click on New Project and select the Visual C++/Windows Metro Style and Blank Application. I named my project: Hello Worm **************************** Visual Studio Version information: Microsoft Visual Studio 11 Version 11.0.50214.1 BETAREL Microsoft .NET Framework Version 4.5.50131 BETAREL image

Name your application

HelloWorld

Or similar

 

Then in your solution explorer click open the BlankPage.xaml

image

Add XAML code that looks like: Make sure to the format: x:Name=”txtBox” If you use the following: Name=”txtBox”

It might work a few times but it is unreliable, so don’t do it use the x:Name

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">     <Button x:Name="btnClickMe" Content="Click ME" Height="100"             Width="100" Click="btnClickMe_Click_1"             Margin="10,26,0,642" />     <TextBox x:Name="txtBox" Text="See Me" Height="50"              Margin="134,51,1111,667"/> </Grid>

Drag a button and a Textbox to the form, move them around to look like my screen or whatever you want: Make sure to name your textbox in the XAML code. Now press F7 to build your code, otherwise the intellisense will not add your textbox name. image
Click on the lightning bolt, this will show you the events associated with the button. Place your mouse in the Click or Tapped (which will work like Click with a mouse and tap with touch screen, so use that one). Type in a name, I typed in: tapHelloWorld image
The tapped event has been entered into the XAML, now you will need to add the instructions to the event. image

Add this code to the tapHelloWorld event, between the braces

image

Run your program you should see a button and a textbox, click the button (or tap it if you have a touch sensitive screen, lucky you!)

       
   image

l