Start learning WPF (i) WPF from Prism?

Source: Internet
Author: User

Starting from Prism learn WPF (i) WPF?

I recently planned to learn about WPF , discovering PRISMWhen I was looking for the MVVM Framework, and before that I learned about other MVVM frameworks from some blogs. For example, the mvvmfoundationmentioned in the MVVM framework--mvvmfoundation in WPF, such as ViewModel, has never been so refreshing-stylet in the lightweight WPF MVVM framework Stylet . When we know that PRISM is the framework of Microsoft's own, it is not hesitate to choose him, even if the individual is inclined to the lovely stylet. As a beginner, without a good understanding of WPF, is it true to learn to use a WPF framework? Fortunately I found this prism-samples-wpf, since it is a WPF application, can it also be used as an example of learning WPF? And the prism of Chinese information is very few, the garden is also relatively old (this goods seemingly few people use) is not too friendly to the novice, so I will learn the prism and WPF process I recorded. If there is a mistake or understand the biased place, I hope you correct me.

Directory:

Start learning WPF (i) WPF from Prism?

Learn WPF from Prism (ii) prism?

Learn WPF (iii) prism-region from Prism?

Start learning WPF (iv) Prism-module from Prism?

Starting with Prism learn WPF (v) MVVM (a) ViewModel?

Starting with Prism learn WPF (vi) MVVM (a) Command?

Start with Prism learn WPF (vii) MVVM (iii) event aggregator Eventaggregator?

0x0 WPF?

Definitions in Wikipedia:

Windows Presentation Foundation (WPF) is one of the components of the. NET Framework 3.0 and later releases of Microsoft Corporation in the United States, which is a set of XML-based,. NET Framework, vector Graphics Technology of the presentation Layer Development framework, Microsoft regards it as the next generation of user interface technology, widely used in Windows Vista interface development.

WPF uses a new XAML (extensible Application Markup Language) language to develop the interface, which separates interface development from background logic, reduces coupling, and enables user interface designers and program developers to collaborate better Reduce the cost of maintenance and updates.

If you have a C # WinForms Foundation, WPF seems to be well understood, he provides an interface development scheme that separates the interface from the background code, and WPF is more aesthetically pleasing than the ugly WinForms, and He's better able to support scaling (WinForms apps at high dpi are just awful).

WPF is free to drag and drop controls like WinForms, and in toolbox you can see that he supports most of the common controls, unlike WinForms, which is the middle designer section, which separates design and XAML.

Each one is xaml equipped with a xaml.cs background file, this is called Code-behind ( App.xaml.cs and also MainWindow.xaml.cs ), which is familiar with the C # code.

xamlWe are not familiar with, for the moment, we look at the contents of these two code-behind:

For the sake of compactness, the using part is omitted

App.xaml.cs:

namespace WpfApp1{    /// <summary>    /// Interaction logic for App.xaml    /// </summary>    public partial class App : Application    {    }}

MainWindow.xaml.cs

namespace WpfApp1{    /// <summary>    /// Interaction logic for MainWindow.xaml    /// </summary>    public partial class MainWindow : Window    {        public MainWindow()        {            InitializeComponent();        }    }}

Looks like something's missing.

What about the Main method? At first I felt the same way, until I tried to App.xaml.cs write a main method in, and then compile it with a mistake:

CS0111  Type ‘App‘ already defines a member called ‘Main‘ with the same parameter types WpfApp1 C:\Users\Yq\source\repos\DotnetTest\WpfApp1\obj\Debug\App.g.cs

It's here! Now let's take a look at this App.g.cs :

For the sake of compactness, still omitted part of the code

Using Wpfapp1;namespace WpfApp1 {//<summary>///APP//</summary> public partial Clas s App:System.Windows.Application {//<summary>//InitializeComponent//</sum mary> [System.Diagnostics.DebuggerNonUserCodeAttribute ()] [System.CodeDom.Compiler.GeneratedCodeAttribute        ("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent () {#line 5 ": \.. \app.xaml "this.                        StartupUri = new System.Uri ("MainWindow.xaml", System.UriKind.Relative);        #line default #line hidden}//<summary>//Application Entry point.        </summary> [System.STAThreadAttribute ()] [System.Diagnostics.DebuggerNonUserCodeAttribute ()] [System.CodeDom.Compiler.GeneratedCodeAttribute ("PresentationBuildTasks", "4.0.0.0")] public static void Main () {Wpfapp1.app App = new Wpfapp1.app (); App.            InitializeComponent (); App.        Run (); }    }}

Although not very understand, but, anyway, we see the main method we are familiar with, his role is very clear,application Entry point. InitializeComponent The method is initialized StartupUri , and he is App.xaml defined in the:

 StartupUri="MainWindow.xaml"

Start learning WPF (i) WPF from Prism?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.