WPF in .NET 4.6.1

Avatar

In addition to the platform and tooling improvements that we delivered in .NET 4.6,, we started looking into WPF App Local as a means of delivering platform improvements in March of this year. We had some early successes in our prototypes that we were super excited about, and we shared that with the community during dotNetLive and the Connect session.

Coming into this investigation, we knew we would have some hard challenges to overcome like ClickOnce performance. As we looked harder at these problems, we realized that the complexity that they were introducing would add a notable burden onto customers (E.g NGEN app local packages). In the light of these findings, we decided that the better solution was to work to improve system-wide WPF instead. At the same time, we want to bring some of the benefits of the app local approach, like quick turnaround of fixes and the ability for customers to privately test these changes into the system-wide version of the framework as well.

First, we want to assure you that we are still committed to continuously servicing the platform, providing important fixes and improvements, and evolving the tooling based on customer feedback. We are exploring ways for partners and the community to provide us with more direct feedback, and participate more easily in testing and validation of fixes and features as they are prepared. This would allow customers to review these changes in a non-production environment for feedback purposes. The following are the improvements that have been delivered as a part of .NET 4.6.1 release.

Performance Improvements

Touch stack performance has been improved with coalescing support added to touch events such that current position is reported after a UI thread delay similar to mouse pointer movements.  Additionally, RichTextBox typing no longer hogs up the Render thread during fast input and you will be able to notice a much smoother experience in this scenario.

DX Integration [Open Source]

One of the highest voted ideas on our UserVoice was to add to WPF the ability to work with DX11 Content in D3DImage easily. We have been able to deliver on that through our WPF DirectX Extensions project hosted here in GitHub. Granted, this still requires a native dll for you author your DirectX visualizations but it enables you to easily integrate it with our custom D3DImage class in the project.

Currently, we have support for Dx10 and Dx11 and in future will extend it to DX11 on 12 and DX 12. If you are curious about what optimizations DX12 gives you, take a look at the article here. The nuget package release is a preview release at this time and we would love to get more feedback from the community on the quality and features before we release a stable version.

WPF Samples [Open Source]

There are a large number of samples available for WPF in MSDN. Unfortunately, there are not easily browsable, targets .NET 3.5 and requires you to individually download each sample to take a look at the content. We have vastly simplified this process by hosting all the samples on GitHub. This is a work in progress and we have moved over 200+ samples (retargeted to 4.5.2) to the repo already. If you see a sample missing from the list, do let us know by raising an issue here.

Spell Checking Improvements

The spell checker in WPF has been updated on Windows 8.1 and above to leverage OS support for spell checking additional languages.  There is no change in functionality on Vista SP2, Windows 7 and Windows 8. The following languages are available to be spell-checked, which includes the languages available for spelling checking in previous versions of .NET Framework (English, German, French, and Spanish).

CultureIETF Language TagWindows 8.1Windows 10LCID (Decimal)
Arabic_SaudiArabiaar-SAYesYes1025
Bulgarian_Defaultbg-BGYesYes1026
Catalan_Defaultca-ESYesYes1027
Czech_Defaultcs-CZYesYes1029
Danish_Defaultda-DKYesYes1030
German_Germande-DEYesYes1031
Greek_Defaultel-GRYesYes1032
English_USen-USYesYes1033
Finnish_Defaultfi-FIYesYes1035
French_Frenchfr-FRYesYes1036
Hebrew_Defaulthe-ILYesYes1037
Italian_Italianit-ITYesYes1040
Dutch_Dutchnl-NLYesYes1043
Norwegian_Bokmalnb-NOYesYes1044
Polish_Defaultpl-PLYesYes1045
Portuguese_Brazilpt-BRYesYes1046
Romanian_Defaultro-ROYesYes1048
Russian_Defaultru-RUYesYes1049
Croatian_Defaulthr-HRYesYes1050
Slovak_Defaultsk-SKYesYes1051
Swedish_Defaultsv-SEYesYes1053
Turkish_Defaulttr-TRYesYes1055
Indonesian_Defaultid-IDYesYes1057
Ukrainian_Defaultuk-UAYesYes1058
Slovenian_Defaultsl-SIYesYes1060
Latvian_Defaultlv-LVYesYes1062
Lithuanian_Defaultlt-LTYesYes1063
Hindi_Defaulthi-INYesYes1081
Portuguese_Portugalpt-PTYesYes2070
Spanish_Modernes-ESYesYes3082
Hungarian_Defaulthu-HUNoYes1038
Urdu_Defaultur-PKNoYes1056
Vietnamese_Defaultvi-VNNoYes1066
Malay_Malaysiams-MYNoYes1086
Punjabi_Defaultpa-INNoYes1094
Gujarati_Defaultgu-INNoYes1095
Tamil_Defaultta-INNoYes1097
Telugu_Defaultte-INNoYes1098
Kannada_Defaultkn-INNoYes1099
Malayalam_Defaultml-INNoYes1100
Marathi_Defaultmr-INNoYes1102
English_UKen-GBNoYes2057
Bengali_Defaultbn-BDNoYes2117

The above list is subject to changes, and is included here for informational purposes only – this list should not be treated as a guarantee for support of spell-checking on these languages. The list of spell-checkers supported by the underlying OS platform can vary over time – additional languages could be added, and existing languages might go out of support – and WPF’s capabilities would correspondingly change as well.

As in the previous versions of .NET, the language for a TextBox control or a RichTextBox block is detected by looking at the following information in the order listed below:

  1. xml:lang is used, if specified.
  2. Current input language
  3. Current thread culture

Additional support for per-user custom dictionaries

With the 4.6.1 RC we have added support for WPF to recognize custom dictionaries registered globally. This capability is available in addition to the ability to register them per-control. Also, custom dictionaries in the previous versions of WPF had no affordance for Excluded Words and AutoCorrect lists. On Windows 8.1 and Windows 10, these scenarios are now enabled through the use of files that can be placed under %AppData%MicrosoftSpelling<language tag>.

  • The files should have extensions: .dic (Added words), .exc (Excluded words) or .acl (AutoCorrect).
  • The files should be UTF-16 LE plaintext that starts with the appropriate Byte Order Mark (BOM).
  • Each line should consist of a word (in the Added and Excluded word lists), or an autocorrect pair with the words separated by a vertical bar (“|”) (in the AutoCorrect word list).
  • These files are considered read-only and are not modified by the system.
  • Note: These new file-formats are not directly supported by the WPF spell checking API’s, and the custom dictionaries supplied to WPF in applications should continue to use .lex files.

Also, see KB3088234 for important additional details.

Per-Monitor DPI Support

Today, WPF applications are system-DPI aware – this means that the applications are scaled by the OS to appropriately depending on the DPI of the monitor on which the application is being rendered. This can result in loss of sharpness, blurry text etc. Application developers have to write additional native code to enable per-monitor DPI awareness in WPF applications.

Given the recent proliferation of high-DPI and hybrid-DPI environments in the ecosystem,  we’re working on a way to enable, out of the box, per-monitor DPI awareness in WPF applications. If you are interested in trying out a preview version of this support, please complete the following survey (available until November 6th). We will be reaching out in the next couple of weeks to those who have signed up and provide invites for downloading the installers from Connect.

Additionally, we are continuing to execute on our previously communicated investment areas and are actively listening to customer feedback. Please send us your feedback through replies to this post, emailConnect bugs and User Voice requests.

  Author: Harikrishna Menon, Senior Program manager, Visual Studio Client Tools Team

Hari is a Program Manager with Microsoft, and works on the Xaml Experiences Team in Visual Studio. He has been with Microsoft for over 6 years, and has shipped multiple versions of Visual Studio working on a variety of XAML tooling experiences spanning different XAML platforms like WPF, Windows Phone and Windows Store.

 

 

Avatar

Follow    

No Comments.