I'm trying to render some controls myself in the compile time. Meaning that i'm trying to create for instance a Xamarin.Forms.Button
and get it's native Windows.UI.Xaml.Control.Button
image (or FormsButton
to be accurate)all in compile time.
I was trying to apply this on a ContentView
so by applying this theory, this is the code to accomplish that:
var contentView = Element.Content;
var renderer = contentView.GetOrCreateRenderer();
var nativeControl = renderer.ContainerLayout;
By doing so i get a native UWP FrameworkElement
with all the properties of the ContentView
like the background and so on. However, i don't get the children rendered. That actually makes sense because basically you render just the ContentView
. But i have no idea how to render all it's children. Hope that the solution applies to any XamarinForms control that has a Children
(or a Content
) property