Non-suspending UWP Desktop Apps
Posted: January 30, 2018 Filed under: C#, UWP | Tags: UWP Leave a commentA traditional Windows desktop application such as a .NET or a classic Win32 application is either running or non-running. This is not true for a Universal Windows Platform (UWP) app however. These kind of apps that run across all Windows 10 devices including phones, IoT devices and even Xbox consoles, enter an additional suspended state when being minimized or switched away from. Read »
Implicit Data Templates in UWP
Posted: March 25, 2017 Filed under: C#, UWP, XAML | Tags: C#, UWP, XAML 1 CommentIn WPF the use of implicit data templates without an x:Key
makes it easy to associate a template with a particular type of object. You just set the DataType
property of the DataTemplate
to the corresponding type and the template is then applied automatically to all instances of that particular type.
The Universal Windows Platform (UWP) however has no concept of implicit data templates. Each DataTemplate
that you define in a UWP app must have an x:Key
attribute and it must be set to a string
value.
Read »
Implementing global hot keys in WPF
Posted: March 31, 2015 Filed under: .NET, C#, WPF | Tags: .NET, C#, WPF 7 CommentsIf you want your WPF application to be able to detect and handle key presses even when it is not currently activated or focused on the screen you could implement what is known as global hot keys in Windows.
A global, or system-wide, hot key is a key or a combination of keys that is associated with a particular window, which will receive messages whenever the user presses this key or key combination from anywhere in the system.
Read »
Enumerating collections that change in C#
Posted: February 28, 2015 Filed under: .NET, C# | Tags: .NET, C# 3 CommentsIf you try you remove an item from an IEnumerable while enumerating it using a foreach loop in C# you will get an InvalidOperationException saying that “Collection was modified; enumeration operation may not execute”.
Read »
Generic type parameters and dynamic types in C#
Posted: October 31, 2014 Filed under: .NET, C# | Tags: .NET, C# Leave a commentThere may be times when you need to use some type in your application that is not known until runtime. This post will explain what you need to do in order to be able to use such a dynamically loaded type from a dynamically loaded assembly as a generic type parameter when you create an instance of some generic class in your application.
Read »
Custom authorization in WPF
Posted: March 24, 2013 Filed under: .NET, C#, Security, WPF | Tags: .NET, C#, IIdentity, IPrincipal, MVVM, WPF, XAML 51 CommentsThis post provides a code sample on how to implement your own custom authentication and authorization in a WPF application by implementing classes that derive from the IIdentity and IPrincipal interfaces and overriding the application thread’s default identity.
Read »