Posts

Showing posts from February, 2019

Xamarin.Forms XmlnsDefinition attribute: All of your namespaces become one

Image
When working on a mobile app developed with Xamarin Forms ( if  you aren’t, you’re missing all the fun! ) you might have your own awesome separate library project   of custom controls, effects, behaviors, value-converters, constants: You’ve might not been very happy ( to put it nicely ) how you're using your library objects in your app’s XAML, having to deal with all the different XML namespaces and prefixes: So many prefixes and namespaces to handle!  Yikes! The issue is not just about declaration of prefixes. Having separate prefixes bloats the XAML a lot because you have to use a separate prefix for every object you reference from the corresponding namespace. In my example there are 4 prefixes to deal with! As a solution to get rid of all the namespaces, a dark thought might have crossed your mind: remove all the CLR namespaces in the library’s code and just have one namespace! But you love your C# namespaces, they give class scope and separation, it’s...