XAML Markup Improvements I have a Windows Store and Windows Phone app, and in this app I have many pages like this:



&lt;Grid Background="Transparent"&gt;
    &lt;ScrollViewer Style="{StaticResource DataPage}"&gt;
        &lt;StackPanel&gt;
            &lt;TextBlock&gt;
                Some text here:
                &lt;LineBreak/&gt;
            &lt;/TextBlock&gt;
            &lt;Viewbox MaxHeight="112"&gt;
                &lt;Border BorderBrush="Black" BorderThickness="1"&gt;
                    &lt;Image Source="MyImage.png"/&gt;
                &lt;/Border&gt;
            &lt;/Viewbox&gt;
        &lt;/StackPanel&gt;
    &lt;/ScrollViewer&gt;
&lt;/Grid&gt;


These pages are loaded into a Frame to be displayed when needed.  Now, however, I have many pages, and I was wondering if there is a better way to do this.  I have been doing it like this so far because easy to make the page content dynamically reload to fit the screen/app size the best with VisualStates and because it is easy to use XAML markup to style my text, image borders (not always there), and layout perfectly, and any solution provided must support everything this does and work in both Windows Store and Phone apps.

Just for reference, this is the C# that loads this page into the frame:



DataFrame.Navigate(Data.Pages[Items.SelectedIndex]);


DataFrame is the Frame, obviously; Data.Pages is an ObservableCollection&lt;Type&gt; in my ViewModel (Data is an instance of the VM class); Items is the ListBox that contains the selectable options.

This image shows the context of what I am doing, with the content in one of these pages outlined in black:
There isn't much to say about the markup here - it looks like much was stripped from the markup. One thing though:

            &lt;Border BorderBrush="Black" BorderThickness="1"&gt;
                &lt;Image Source="MyImage.png"/&gt;
            &lt;/Border&gt;


I wouldn't hard-code paths into the XAML like this; instead, bind to an ImageSource property on your ViewModel. If/when that image needs to change, you'd certainly rather modify C# code than dig up the path in the XAML markup.