Search code examples
xamarin.formsuielement

Creating UI elements in Xamarin.Forms


I am not in Xamarin.Forms. In windows desktop apps (win forms and wpf), you can create a user UI component and you can use it in any project. Is it possible to create that kind of small UI elments in Xamarin.Forms?

I will have like a dll and will add to my project and will add to my form and I will give properties that I'll already defined in the UI element.


Solution

  • So, in Xamarin Forms world, we typically create User Controls through use of ContentView.

    This can be done with a XAML part and code behind, but you can easily create them just in code too. There are a series of tutorials available on the web, one that is very clear is this one https://mindofai.github.io/Creating-Custom-Controls-with-Bindable-Properties-in-Xamarin.Forms/

    If needed, you can create a separate Xamarin Forms project that encapsulates your controls and reference that in your main app solution.