Sunday, March 03, 2013

Brain Dead Simple Windows RT App

Brain Dead Simple Windows RT App Part 1

This article creates a really simple base app that I will use as a starting point for at least 1 other blog post (I’m holding this one until the first one is done).

In this series I will site design standards and then violate them. My intention is to justify why you need to learn how to use things like App Bars and Charms. At the same time, I don’t want to spend too many words trying to make everything UX correct. Microsoft has committed thousands of bits to the internet about Windows 8 UX standards on MSDN and various blogs.

Build the Brain Dead Simple App

  1. Create a new Visual C# Windows Store “Blank App (XAML)”
  2. Call it “HelloWindows”
  3. Open MainPage.xaml
  4. Within the bottom most Grid, add a text block with the Text of “Hello Windows”



I added a little style and now the grid XAML looks like this:

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <TextBlock Text="Hello Windows" 
        Style="{StaticResource HeaderTextStyle}"
        HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>

Add Binding for Future Proofiness

I know that I will need to make my app a little more interactive. With this in mind, I’m going to add some really simple binding code and XAML plumbing so I can separate this from the later posts.

public sealed partial class MainPage : Page, INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    private const string BASE_MESSAGE = "Hello Windows";
    public MainPage()
    {
        this.InitializeComponent();

        HelloMessage = setMessge(ExlamationPointCount);
        this.DataContext = this;
    }

    private void RaisePropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
AND XAML
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <TextBlock Text="{Binding Path=HelloMessage}" 
        Style="{StaticResource HeaderTextStyle}" />
</Grid>

My Brain Dead Simple Windows RT App: The Series

No comments: