Thursday, March 28, 2024 09:02

Table of contents >> Graphical User Interface > WPF

WPF

Back in the day, in the golden days of prehistoric programming (~’80’s), programmers were writing programs that would only display text. Graphics were rare and hideous, and the majority of computer programs were as basics as it gets. Here is a screenshot of Lotus 123, which was a spreadsheet program used for financial jobs:

Up to this point, all the lessons I have taught you were exemplified using the same command line interface (CLI). It is now time to start learning about graphical user interfaces (GUI) and the way we interact with graphical programs. Visual C# offers two alternatives for coding graphical programs: Windows Forms (WinForm) and Windows Presentation Foundation (WPF).

WinForms is a very old technology that is not currently supported or updated by Microsoft anymore, and it is present only because there are still tons of applications developed using it, that require maintenance, debugging, etc. The good side of the WinForms is that they are rather easy to use. The downside is that they are old, discontinued and don’t offer as many possibilities for a rich user interface.

WPF is a powerful tool for creating powerful applications, with the ability to create highly customizable user interfaces. It is based on DirectX and it employs XAML – an XML-like markup language for defining, customizing and fine-tuning the user interfaces. There are a lot of advantages to WPF compared to WinForms, but they are not the subject of this lesson. The main disadvantage of WPF and XAML is that there is quite a steep learning curve if you want to master them as a beginner, or a user coming from WinForms development. The good news is that if you are not a graphician and you don’t really care about very sophisticated user interfaces, everything will be rather easy.

Both WPF and WinForms are event driven programming technologies. As we will see in later lessons of this chapter, GUI’s are composed of controls which have properties, methods and events. We will go through the process of learning the basic knowledge about the core WPF controls, designing our first GUI and implementing it in our first GUI program.

 

Tags: , , , ,

2 Responses to “WPF”

  1. Ayyaz Sheikh says:

    Was Lotus 123 a software??. And one thing more…Is it ok to use WinForms nowadays ???

    • rusoaica says:

      According to a simple google search, the first result states: “Lotus 1-2-3 is a discontinued spreadsheet program from Lotus Software (later part of IBM). It was the IBM PC’s first killer application, was hugely popular in the 1980s and contributed significantly to the success of the IBM PC”. So, yes, it was a software.
      As for the WinForms, they are just a GUI library. The functionality should not be linked with the interface in any way. The same functionality should work on a Winforms or a WPF based GUI. The only problem is that WinForms were not built with this concept in mind. Also, WinForms do not allow such level of customization as WPF/XAML. So, yes, if you are interested in just the functionality of a program and you don’t care about the way your UI looks, you can probably still use WinForms without problems. Still, you will lack many WPF features such as data binding, automatic GUI update of data, etc.

Leave a Reply



Follow the white rabbit