Edi Wang

Windows Development 80


Automatically Set Text Color on Accent Background in UWP

Windows 10 allows users to set accent color for the system, and in UWP apps, we usually honor those settings by using XAML pre-defined resource keys like {ThemeResource SystemControlBackgroundAccentBrush}. But regardless of how the user set default app mode to dark or light, when we apply text on accent colors, it may have some problems. For example, when the App is in light mode, the default...

XAML UWP

Configure VSTS Build for UWP Apps

UWP Apps usually require a lot of time to compile a "release" package for submitting to Windows Store, and if you are working in a team, TFS/VSTS can help your team ensure that each check-in has a success build, and make it easier for deployment and testing. Let's see a basic example of how to setup a CI build for a UWP App on VSTS. Important Pre-condition: Before you do that, please ensure...

UWP VSTS

Windows 10 UWP: Switching Languages in Your App

By default, a UWP App's UI language is automatically fits the system current language settings. However, what if the user need the ability to set a particular UI language just for your App without having to change system language? In my App, I supports Simplified Chinese and English. The user can override the system language in App's settings page: So how to do it? First, you need to have res...

UWP Localization

Windows 10 UWP: How to Read and Save Settings Easily

In the UWP Application model, reading and saving settings are very similar to WinRT API. The class we are using is ApplicationData.Current.LocalSettings It is using key-value-pair to store settings. LocalSettings will stay on the user's current computer, and not being synced with thier Microsoft account. The API to save settings is: LocalSettings.Values[key] = value; To read settings:  if (Lo...

Windows 10 UWP

Windows 10 UWP: How to Debug OnFileActivated Launch Failure

Today I am working on my Image Portray App, and I get my code blown up. The problem is, when the App is already started, it can open .ink file with double click from a file. But when the App is not launched, opening a .ink file to start the App will make it crash. As other UWP that supports file type association, I also use OnFileActivated event to launch my App. This kind of problem could not be...

Debug Visual Studio UWP

10 Tricks and Tools for Windows 10 UWP Development

After Windows 10's launch. More and more UWP applications are coming as well as more Windows developers. I am doing UWP development besides my job for more then 2 years. Today, I will share some tips and tricks from my UWP development experience as well as some handy tools, so that you can do your development more quicker and easier. 1. Automatically Set Color to Title Bar The default color...

UWP

Windows 10 UWP: Undo / Redo Ink with Surface Dial

The Surface Dial is the first wheel device in a new input device class. I got my hand on one as soon as it came to market in China. I have a UWP App named "Image Portray", as a drawing app that can make use of the Surface Dial. One of it's useful application to undo / redo the ink by turning the Surface Dial. You can download it from Windows Store these days to see the changes. So, let's begin w...

UWP Surface Dial

Windows 10 UWP: Undo / Redo on InkCanvas

The InkCanvas in UWP only got pens by default, it can not perform Undo or Redo. To implement this, we will need to code for ourselves. Official document covered Undo functionalilty, but not redo. Today, I have successfully done it, and I'd like to share with you. First, you need to add two custom buttons on the InkToolbar for Undo / Redo 1. Undo the Ink We need a few A...

Stack UWP InkCanvas

Remote Deploy and Debug UWP Apps

These days I am developing an App that need to be tested on multiple languages environment. I can set my local dev box to different language, and restart or sign out / sign in to Windows again to test different languages. But this is very inconvenient. I want to setup a Windows 10 virtual machine with Chinese language and let Visual Studio 2017 deploy and debug the App right into the VM. Back the...

Debug UWP

How to Save InkCavas to Image in Windows 10 UWP

The InkCanvas control in Windows 10 UWP is not like WPF where you can save as image file easily. If you want to save user ink to an image file, there's by far only one way to do it: 1. Install Win2D.UWP via NuGet into your project. PM Install-Package Win2D.UWP 2. Because we need to access user's picture library, so we need to apply the permission in manifest file. Select "Pictures Library"...

Windows 10 UWP