Hello.

I am Paul Kinlan.

A Developer Advocate for Chrome and the Open Web at Google.

I love the web. The web should allow anyone to access any experience that they need without the need for native install or content walled garden.

Google Search: C#, Finding the Locale

Paul Kinlan

This post discusses how to determine a user's locale in C#. For ASP.NET applications, the Request.UserLanguages array provides the user's preferred languages, with the first element being the primary locale. This can be used to set the thread's culture using CultureInfo.CreateSpecificCulture(). In Windows Forms or services, the current culture can be accessed via Thread.CurrentThread.CurrentCulture and several properties like TwoLetterISOLanguageName or DisplayName allow retrieval of locale information.

Read More

Changing Styles with the times

Paul Kinlan

I'm exploring ways to dynamically change the layout and styles of my Avalon application at runtime, allowing users to switch between different UI themes. I'm considering several approaches:

  1. Stylesheets: Can styles be stored externally and loaded dynamically? I've looked at DynamicResource but I'm unsure if it supports loading XAML from external files.
  2. Dynamic XAML Loading: Can I reload the XAML used by a window at runtime using LoadComponent? The _contentLoaded flag suggests this might not be possible.
  3. Restart on Style Change: A simpler but less desirable option is to require the application to restart when the user changes the UI style.
  4. Localization Analogy: Could the localization framework be adapted for loading different XAML files? I'm unsure if there's a connection between Resource Files and XAML resources.

Read More