Let’s start by creating our first WPF application
Open Microsoft Visual Studio from Start Menu
Click File –> New project. Select “Windows” in Installed Templates and select “WPF Application” project type.
This will create below WPF project structure.
Understanding Project structure of WPF.
Solution Name - FirstWPFProject. One solution can have multiple projects and class libraries.
Project Name - FirstWPFProject. This is our WPF project that contains project files.
Project Files:
App.xaml - This page is the entry point of the application. When application starts, App.xaml is called first which has reference to the window to be displayed. By default it reference to MainWindow.xaml
App.xaml.cs - This is code behind file for App.xaml page which contains application level events like Startup, Exit, Activated, Deactivated and DispatcherUnhandledException
MainWindow.xaml - This is a sample window added by default and displayed when application starts.
MainWindow.xaml.cs – This is code behind file of MainWindow.xaml to write application logic.
References: .net framework / external assemblies added to this project.
AssemblyInfo.cs - This file contains Information like title, description, product, company, signing and versioning that makes assembly self-describing.
Resources.resx – Resources.resx provide central location to store application resources like strings, images, icons, text files and access them in strongly type manner. Resources.resx files are also used for localization. By default, resources are embedded in project EXE or DLL but can also be complied into separate satellite assemblies.
Settings.settings - Settings are used to store information on user computer. Settings can be user preferences, address of web server, connection strings etc. Application level settings are constant for every instance of application regardless of user. Application level settings are read-only i.e they are defined at design time and their values can not be changed at run time. User settings are user-specific. User settings are read/write i.e they are defined at design time and their values can be read or write at run time.
No comments:
Post a Comment