Building an OSD Front End using C#: Part 2 – Initial Form Configuration

Now that we have our development environment sorted and our basic project created we need to lay out the basic framework for our form.  Since we’re using the MahApps.Metro resources we’ll need to change a few things to get everything looking right.

  1. Open the MainWindow.Xaml file from the right hand menu and update the <Window tag to be <Controls:MetroWindow
  2. Now we need to make some changes to the MetroWindow tag, see the following code block and compare to your project. This will add in the namespaces we’ll be using as well as adding in some info about the overall form design.
<Controls:MetroWindow x:Class="UMN_OSDFrontEnd.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:local="clr-namespace:UMN_OSDFrontEnd"
        mc:Ignorable="d"
        Closing="MetroWindow_Closing"
        Loaded="MetroWindow_Loaded"
        Title="UMN OSD FrontEnd" Height="500" Width="1000" ResizeMode="NoResize"&gt;
  1. Open the MainWindow.Xaml.cs file and change the MainWindow class to be MainWindow : MetroWindow
using MahApps.Metro.Controls;

namespace UMN_OSDFrontEnd {
    public partial class MainWindow : MetroWindow {

We should now be able to use F5 to build the application and have a basic Xaml form without any info on it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.