Regions in XAML

Did you know? Regions are working in XAML!

Hi folks,
I just discovered that’s possible to use regions in XAML #VS2017 – About C# regions and now #Xaml regions also (What?!). Following the original article, it seems that there are some discussions about the benefits of regions. I won’t go further, apparently there are already many discussions on the net.

Personally, I find regions quite useful if used with parsimony. Especially when discovering code from a colleague or some old code from me. But that’s nearly the same, as today I’m not writing code the same manner as yesterday, hopefully better 😉

Until today I really missed it in XAML. In XAML it’s less easy to make code refactoring and things tend to be very verbose. So, it’s great (old) news for me and perhaps some other guys who missed it also.

But back to the basics: What is it about. It’s all about grouping code and having a nice resumé instead:

_config.yml

Shows up as:

_config.yml

The good news is: If you don’t like it, just leave it and read it like any other comment in the code. There is no obligation to click on it 😉

XAML regions are working in WPF, UWP and Xamarin.Forms XAML …

Greetings from France,
Michael

Written on August 16, 2019