Edi Wang

Microsoft MVP for Azure

Windows Development UWP, WPF, WinForm, etc

How to Check If .NET Core Program is Running under Remote Desktop

There are a few reasons that we need to know if our program is running under the Windows Remote Desktop (RDP) session. For example, if it is running under RDP, we may disable animation and other fancy graphics effects. But how can we detect if our program is currently under RDP? Let's see. Windows Forms If you are developing Windows Forms Apps using .NET Core 3.x, there's a built-in API that can …
.NET Windows Remote Desktop

Upgrade WinForms Apps from .NET Core 3.0 to 3.1

I upgraded a WinForms App to .NET Core 3.1 these days. It's an open-source on-screen ruler created by Jeff Key in 2004, the original code was for .NET Framework 2.0, I've already upgraded it to .NET Core 3.0 in September this year, it was very smooth without any code change. But this time, .NET Core 3.1 does require some code changes.  The project is on my GitHub: https://github.com/EdiWang/ …
.NET WinForm

About Per Monitor-DPI aware for WinForms Applications

WinForms is the traditional .NET desktop application workload running on Windows. For historical reasons, there are some problems with its support for high DPI and for different DPI screens, and this article explores the possible solutions. Windows "96" PPI history The default DPI for Windows systems (more precisely called PPI) is 96. PPI means pixel per inch, which means how many pixels are …
.NET WinForm DPI

Read and Write Windows Registry in .NET Core

Yes, you read it right! It's totally possible! Even .NET Core is designed to be cross platform, but it does not mean you can not use platform specific APIs. Take Windows Registry for example, although .NET Standard can not contain Windows API like this. But there's still a way to use Windows Regisitry in .NET Core Applications. But first, you should be absolutely clear, that using platform …
.NET Windows Registry

How to Remove Default FDS Effects in UWP Apps

The Fluent Design System introduced by Windows 10 from v1709 is very beautiful, the latest v1809 further refined FDS, many UWP built in controls got FDS effect by default while developers do not need to do anything. This is usually a good thing, but it can also cause performance problems for some apps. My Character Map UWP is one of the victimized apps, and let's take a look at how to remove the …
UWP

Automate Windows 10 Developer Machine Setup

One of the things programmers hate most is probably setup a computer. Because the programmer's computer environment configuration is very different from normal people. In general, it takes several hours to manually install a new development machine. Let this process automating, after all, the essence of programming is to let complex things simplify, find a way to be lazy! In fact, automatic …
Windows PowerShell Choco

Build a Pixel Ruler with UWP

In certain applications, we may need an on-screen ruler that indicates pixels on the screen. However, the only built-in ruler in UWP is within the InkToolbar control, we are not able to use it elsewhere. So, I will teach you how to build a pixel ruler which can be used anywhere in your UWP applications. The Demo App Create a new blank UWP application called PixelRulerUwp with minimal runtime …
UWP Win2D

Fix AcrylicBrush Missing on NavigationView in Windows 10 SDK 17763

Microsoft released a new version of Windows 10 UWP SDK Build 17763, you can check the What's New document for more details. But when I retarget my App to version 17763, something unexpected happens, the AcrylicBrush gone missing if I change my App runtime to version 17763. I am not sure if this is by design on 17763 or it is a bug, I am trying to contact Microsoft product group on this problem. …
UWP

How to Fix Extended TitleBar Overlapping NavigationView PaneToggleButton

In UWP Apps, we some times extend our main view into title bar to get rid of Windows 10 default title bar. However if you are using NavigationView under extended title bar, you will find your PaneToggleButton overlapped by the title bar. And the user won't be able to click on the upper part of the button because it is where the title bar need to respond to window drag actions. This image shows …
XAML UWP

Windows Community Toolkit: Use CameraPreview to Take Photos

In UWP Apps, if we want to use the device's camera to take photos and save to a file, it is used to be some how complicated, the developer need to know about quite a lot things and also write quite a few code to get it down (As you can find the Camera examples from Microsoft offical sample code). In fact, in many cases, we just want to take a photo by the most easy and default options via the …
UWP Camera