WPF Main Application

Introduction

Windows Presentation Foundation (WPF) is yet another fiery hell software developers have to experience from Microsoft. Yet the flame is so beautiful I have to look through each spark.

Main WPF Application

A template provided by Visual Studio 2008, these files are created. These are files created inside the WPF application project file.

App.xaml And App.xaml.cs

The main entry of a typical WPF Application. WPF UI can be instantiated by the usual Main() method when the application is standalone, but App.xaml and its App.xaml.cs code-behind is required for application run in XAML browser applications and it is a standard signature for a WPF application. There must be one Application class created per AppDomain. Description of the main application can be done in the code-behind or in XAML.

x:Class="WPFApplication.App"

Given namespace WPFApplication and class name App that inherits from Application, x:Class points to the code-behind of App.xaml

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" provides the default XML namespace. This convention is similar to the old using statement.

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" provides additional XML namespace.

StartupURI

It's Application attribute that points to a UI that is automatically shown when an application starts.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License