12. Practise 2

WPF (Windows Presentation Foundation) Practice 2

Introduction to WPF

Windows Presentation Foundation (WPF) is a UI framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, and documents.

Key Points:

WPF Architecture

Understanding the WPF architecture is essential for using its rich set of features effectively. The architecture is designed in layers, each one building on top of the one below it.

Working with WPF

Creating a WPF Application in Visual Studio

Here is a simple example of creating a WPF application in Visual Studio:

// Create a new WPF Application project
// File -> New -> Project -> WPF App (.NET Framework)

After creating the project, you will see a MainWindow.xaml file:

<Window x:Class="WpfApp1.MainWindow"
        xmlns="<http://schemas.microsoft.com/winfx/2006/xaml/presentation>"
        xmlns:x="<http://schemas.microsoft.com/winfx/2006/xaml>"
        Title="MainWindow" Height="350" Width="525">
    <Grid>

    </Grid>
</Window>

Working with Controls

Controls are the building blocks of a WPF application. For example, here is how you can add a Button control to your application:

<Button Content="Click me" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75"/>

Conclusion

WPF is a powerful framework for building Windows desktop applications. It provides a unified approach to UI design by combining the best of both Windows Forms and HTML. This was a brief introduction to WPF and in subsequent lessons, we will delve deeper into its features and functionalities.

Reference

The content in this document is based on the original notes provided in Azerbaijani. For further details, you can refer to the original document using the following link:

Original Note - Azerbaijani Version