WPF in .NET 4.6.1

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).

Culture

IETF Language Tag

Windows 8.1

Windows 10

LCID (Decimal)

Arabic_SaudiArabia

ar-SA

Yes

Yes

1025

Bulgarian_Default

bg-BG

Yes

Yes

1026

Catalan_Default

ca-ES

Yes

Yes

1027

Czech_Default

cs-CZ

Yes

Yes

1029

Danish_Default

da-DK

Yes

Yes

1030

German_German

de-DE

Yes

Yes

1031

Greek_Default

el-GR

Yes

Yes

1032

English_US

en-US

Yes

Yes

1033

Finnish_Default

fi-FI

Yes

Yes

1035

French_French

fr-FR

Yes

Yes

1036

Hebrew_Default

he-IL

Yes

Yes

1037

Italian_Italian

it-IT

Yes

Yes

1040

Dutch_Dutch

nl-NL

Yes

Yes

1043

Norwegian_Bokmal

nb-NO

Yes

Yes

1044

Polish_Default

pl-PL

Yes

Yes

1045

Portuguese_Brazil

pt-BR

Yes

Yes

1046

Romanian_Default

ro-RO

Yes

Yes

1048

Russian_Default

ru-RU

Yes

Yes

1049

Croatian_Default

hr-HR

Yes

Yes

1050

Slovak_Default

sk-SK

Yes

Yes

1051

Swedish_Default

sv-SE

Yes

Yes

1053

Turkish_Default

tr-TR

Yes

Yes

1055

Indonesian_Default

id-ID

Yes

Yes

1057

Ukrainian_Default

uk-UA

Yes

Yes

1058

Slovenian_Default

sl-SI

Yes

Yes

1060

Latvian_Default

lv-LV

Yes

Yes

1062

Lithuanian_Default

lt-LT

Yes

Yes

1063

Hindi_Default

hi-IN

Yes

Yes

1081

Portuguese_Portugal

pt-PT

Yes

Yes

2070

Spanish_Modern

es-ES

Yes

Yes

3082

Hungarian_Default

hu-HU

No

Yes

1038

Urdu_Default

ur-PK

No

Yes

1056

Vietnamese_Default

vi-VN

No

Yes

1066

Malay_Malaysia

ms-MY

No

Yes

1086

Punjabi_Default

pa-IN

No

Yes

1094

Gujarati_Default

gu-IN

No

Yes

1095

Tamil_Default

ta-IN

No

Yes

1097

Telugu_Default

te-IN

No

Yes

1098

Kannada_Default

kn-IN

No

Yes

1099

Malayalam_Default

ml-IN

No

Yes

1100

Marathi_Default

mr-IN

No

Yes

1102

English_UK

en-GB

No

Yes

2057

Bengali_Default

bn-BD

No

Yes

2117

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%\Microsoft\Spelling\<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.