Enhancements in WPF in Visual Studio 2015 and .NET 4.6

Background

For a long time in the software development world it was assumed that desktop applications will be dead. This misconception has existed for more than half of a decade. But it's not the reality because the Line Of Business (LOB) applications are still heavily used as desktop applications in various businesses, for example Reporting, Data analytics or simple data entry form application. Talking of desktop application comes with talking about Windows Forms and WPF.

Windows Forms and WPF

Windows Forms have remained as a part of software for a long time now. They have been upgraded to WPF because of the better UI and great user experience. Now WPF has been in the market for a long time. Developers were afraid that some other technology will soon be in the market to replace the WPF. It was obvious because we didn't hear anything related to WPF from Microsoft. But finally, we have some news and updates from Microsoft that will provide a great relief to developers and businesses. Because this time we have a great enhancement of WPF. This article will explain those important changes that will change the experience of WPF in terms of performance (many requests were raised regarding the performance).

Improvements in WPF with .Net 4.6 and Visual Studio 2015

Profiling on the go: Now one can start profiling of WPF applications. The profiler provides the ability to choose either one or both between the CPU usage and Memory usage.

To Launch a profiler go to Debug –> Start Diagnostic tool without debugging. (A previous article explained that the Diagnostic tool is now part of the Debugging process.)


Figure 1: Debugging Process

Here's a preview of how the diagnostic will look like:


Figure 2: Analysis Target

This might look like something like this when you select the options to diagnose and start diagnosis:


Figure 3: Start Diagnosis

(Note for the editor team: the preceding image is an animated image. Download the animated image from (http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-38-64-metablogapi/4024.Start_5F00_thumb_5F00_56B71C4C.gif).

When you stop the diagnosis it'll generate the reports for each type of diagnosis selected.


Figure 4: Diagnosis Selected

These reports will contain the “Worker Thread” state, CPU usage and memory usage including the Hot Paths. To learn reading these report see the MSDN detailed article.

Dynamic UI diagnostic tool

Those who have worked extensively on WPF apps know the pain of debugging the UI. That time there were tools used to debug the UI stuff. Now this “Most Wanted” feature now can be found in Visual Studio 2015. The enhancements are not just spying, but also giving the ability to change the Live UI items when running and debugging the application has just been made “Awesome”.

The diagnostic tools are known and available as “Live Visual Tree” and “Live Property Explorer”. To enable this tool go to the “Debug” menu item when debugging and go to Debug –> Windows –> Live Visual Tree.


Figure 5: Diagnostic Tool

Now you can see the following windows. There are options to Enable/Disable the dynamic finding of the UI elements from the UI and changing the properties accordingly. Awesome stuff, “Try it yourself”.


Figure 6: Properties

This will change many things and will help speed up the development process.

XAML Editor vs Designer window

Developers rarely use the designer window to design the component. Most of the time they're relying on pure XAML coding stuff. Previously It was pretty annoying to have a designer and XAML editor window together. Now you can “Turn off” the designer if you don't like it there. Simply go to Tools –> Options –> XAML Designer. And turn it off by unchecking the box.


Figure 7: Designer Window

I know you all must be liking these changes so far. This is not all, there are a couple more stuff you can checkout and that might help you with the Development.

Here are a couple of more items that are in the list that shipped with .Net 4.6 and Visual Studio 2015 RTM:

  1. Deferred/Lazy loading of Visual elements
  2. UI Virtualization for data intensive applications
  3. High Definition devices support
  4. DirectX interoperability
  5. Support of Modern device (Touch screen device)
  6. Multi-image cursor file support in System.Windows.Input.Cursor
  7. Support for transparent child windows.
  8. Improved double tap gesture recognition by using common threshold distance from registry.
  9. Improved text selection using double tapping the WPF TextBox control.
  10. Improved reliability of stylus input for the WPF ComboBox control.

These are the improvements that can be posted as a dedicated article so I am not explaining everything in this article. But the future of WPF is bright with these enhancements. The combination of XAML and C# will be there in the market for a long time.

For more details watch this Channel9 Interview with WPF team.

Note: These are the features that I liked most (out of those all shipped in the RTM) and are are based on my own research.

Up Next
    Ebook Download
    View all
    Learn
    View all