Code-Behind for ResourceDictionary in WPF

1 ยท Alexey Golub ยท Oct. 29, 2016, midnight
As any WPF developer knows, XAML can get messy due to all the nested elements and indentation. One common problematic area is data templates โ€” they are naturally decoupled from the surrounding layout but are still nested quite deep in the hierarchy. To deal with it, you can refactor some of the commonly used objects as resources into a ResourceDictionary, which can also be self-contained in its own separate XAML file. Dictionaries can later be referenced using the Source property or by including...