C++: Secret XAML with C++ news

One of the things it always seemed was that real secret stuff is kind of boring and detailed.  Except if the stuff isn’t secret anymore, during that transition period everyone gets excited and sometimes thrown in jail.

So what does that have to do with XAML and C++?  And why is it secret.  It isn’t really secret, but when I write stuff on my blog I am pretty sure that no one on my team reads it.  So it’s secret from my managers and teammates and just things I want to share with you.  Sort of like the Purloined Letter by Poe, a good read, which is weird, when I read the classic books I hated in high school and college now, they are pretty good reads and on Kindle or Nook they are free, so that is a good thing.

Anyway what do I want to share with you?  Getting started with the VS 12 Beta.  There were some problems with the VS 11 versions.

Note that the menu line has all capitals.  That’s strange.  I like the look.

When you use the toolbox for the first time it pulls in from a file and takes a few seconds.

I generated the Blank Template and then modified the XAML to look like the following using drag/drop and entry as required:

<!—XAML code –>


    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        < TextBlock x:Name="HelloWorld" HorizontalAlignment="

            Left" Margin="189,88,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="76" Width="156"  

            Foreground="White" FontSize="22"/>

        <Button Content="Button" HorizontalAlignment="Left" Margin="390,100,0,0" VerticalAlignment="Top" Tapped="HelloWord"/>

< /Page>

<!--- End of the code –>

Then in the Code Behind I added the following, make sure to do a save all or the indirect constructor won’t activate the intellisense until you build.

//*************** Code, added the highlighted line *********************


/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.  The Parameter
/// property is typically used to configure the page.</param>
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
    (void) e;    // Unused parameter

void FirstVS12App::MainPage::HelloWord(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e)
    HelloWorld->Text="hello world";


Comments (0)

Skip to main content