Here I’d like to describe some approaches how .NET applications can be localized. General In general the texts that are supposed to be localized should…
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);…
<ComboBox ItemsSource=“{Binding Source={x:Static Fonts.SystemFontFamilies}}“ SelectedItem=“{Binding SelectedFont, UpdateSourceTrigger=PropertyChanged}“ /> The ComboBox is bound to the System Fonts enumeration. The SelectedItem DependencyProperty is bound to a SelectedFont…
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…
You can simply use styles to enable text wrapping in a WPF DataGrid Column. This sets the element style of the standard column control and…
This checks the availability of a server by sending a ping to the given IP address and waiting a certain amount of time for a…
Not all possible characters are suitable for file names. For example path separators cannot be used for file names. This changes any string into a…