We would like to talk about two graphical systems used in .NET. WinForms and WPF are popular in our time. The question is which technology to use in application development. We will examine each system in detail, discuss the pros and cons, and talk about the peculiarities of using them in FastReport .NET and FastReport WPF products. Let's turn to the comparison.
First, let's talk about the old WinForms system, which is already considered a classic. This Framework 1.0-based system was released back in 2002 and offers a "traditional" way to create desktop applications. We have basic elements like "Button," "Text object," "Text field," etc., which can be customized almost as you like. It is generally quite convenient, but unfortunately, we will not be able to create a modern application design, which may not suit us or our clients. Nowadays, quite a few applications use WinForms, for example, FastReport .NET. But it is worth considering that often such applications were developed and supported for a long time. This is mostly a necessary measure because the application’s appearance plays a really important role.
Pros and Cons:
+ The technology has been extensively tested and proven, which gives reliability.
+ There are many ready-made solutions and controls.
+ Simplicity and intuitive concept when creating an application.
- Does not meet modern development standards.
- No active support.
Everything becomes much more interesting here. WPF technology was also introduced a long time ago, in 2006, based on Framework 3.0. However, it has a fundamental difference in the development process. Now, there are no familiar elements that we can place on a form and customize. We will now have to write code in XAML to add the same button or text object. And indeed, it is much more convenient to simply drag and drop and customize the desired object rather than starting from scratch and configuring everything. In this case, we even gain an advantage. But how? Let's look.
Let's take an example of a button with an image and text. WinForms does not offer ready-made solutions. Therefore, you need to create your own images and implement your own buttons that support images or use a ready-made custom solution. A WPF button can have anything inside it since it's just a "frame" with content. For example, pressing or not pressing with a reaction to cursor hovering.
This way, we have a maximum flexible configuration, which can confuse the developer. On the other hand, we get from the application what we want.
Pros and Cons of this approach:
+ The graphics system is newer and meets development standards.
+ Microsoft uses it in many of its applications, such as Visual Studio.
+ More flexible configuration system.
+ There are ready-made solutions for any need.
+ Using XAML, you can separate the work of a designer and a programmer.
+ For better performance, you can use hardware acceleration.
+ You can create an interface for both Windows and Web applications.
- You need to learn how to work with XAML.
So, we have discussed the two graphical systems and learned about their advantages and disadvantages. Now let's delve into their integration with FastReport .NET. The main differences are in the connection method and visual components.
In the case of WinForms, we need to connect FastReport.NET.nupkg or FastReport.dll, write the necessary code, and run the project. Alternatively, we can simply launch FastReport .NET. As a result, we will get the familiar form.
In the case of WPF, we need to include the FastReport.WPF package. And also write the necessary code and launch the project. In the case of WPF, we will get a more modern design and a similar interface.
It is also worth mentioning that we can utilize Intellisense from Roslyn when using WPF, which helps in code writing.
Thus, we have discussed the two graphical systems. The decision of which one to use in application development is up to you. However, we recommend using WPF. Yes, it may be inconvenient and unfamiliar after WinForms, but with WPF, we gain a modern and user-friendly design and long-term support.