I have two custom views (HybridEntry and HybridSlider) with custom renderers for each platform. In the custom renderers, HybridSlider has to use some of the platform-specific functionalities of HybridEntry.
In short, I want to access the native control of HybridEntry inside the custom renderers of HybridSlider.
I could pass the reference of the Forms HybridEntry to the Forms HybridSlider class in the xaml by declaring a property named HybridEntry inside of HybridSlider class.
XAML:
<local:HybridEntry x:Name="hybridEntry"></local:HybridEntry>
<local:HybridSlider HybridEntry="{x:Reference hybridEntry}"></local:HybridSlider>
Custom renderer of HybridSlider in UWP -
using Windows.UI.Xaml.Controls;
using Xamarin.Forms.Platform.UWP;
[assembly: ExportRenderer(handler: typeof(Core.CustomView.HybridSlider), target: typeof(Demo.UWP.Renderers.HybridSliderwRenderer))]
namespace Demo.UWP.Renderers
{
public class HybridSliderwRenderer : ViewRenderer<Core.CustomView.HybridSlider, UserControl>
{
protected override void OnElementChanged(ElementChangedEventArgs<Core.CustomView.HybridSlider> e)
{
base.OnElementChanged(e);
if (Control == null)
{
var formsHybridEntry = e.NewElement.HybridEntry;
Demo.UWP.HybridEntry uwpEntry= (Demo.UWP.HybridEntry)formsHybridEntry; // I WANT TO GET THE NATIVE control here
}
}
}
}
How could I access the native control class which is associated with the HybridEntry class inside of custom renderer of HybridSlider?