In this post I will explain how to create a thread safe queue that can hold multiple tasks. You will be able to add multiple…
Dependency properties are widely used in WPF controls. However there is no buid-in way to listen to changes of such properties. The following class is…
The following code contains extension methods for the random class. One method will create random dates between a given minimum and maximum. The second method…
This post gives you an overview of the MVVM (Model-View-ViewModel) pattern. There are many similar very good articles like this, giving you a rough overview,…
In this post I will show how to create a spinning progress control in WPF. This is often used to notify the user that a…
The following code removes the BOM (Byte Order Mark) from texts. Some text editors add that while saving files. Sometimes this leads to problems while…
Sometimes it is important to prevent certain code being executed at design time. public static bool IsDesignTime { get { return (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime); }…
Path of the executing assembly: public static string GetExecutingAssemblyPath() { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uri.Path); return Path.GetDirectoryName(path);…
If you need to show a list of languages, or more general CultureInfos, you might want to sort them by the name they show up…
Calculating a leap year The correct calculation of a leap year was first introduced by pope Gregor in 1582. The Gregorian Calendar is still commonly…