Maybe I am looking at this in the wrong way but I cannot find information about what how and when to use what, to convert a (Label)renderer to (Label)handler.
Let's take this example, this is what worked in Xamarin.Forms:
public class StrikeThroughLabelRenderer : LabelRenderer
{
public StrikeThroughLabelRenderer(global::Android.Content.Context context)
: base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
if (Control != null && Element != null)
{
Control.Text += ' ';
Control.PaintFlags = Control.PaintFlags | PaintFlags.StrikeThruText;
}
}
}
Here you can see a simple renderer which uses 'Element' and checks if it isn't null. How and where do I find the correct way to convert things like this, as I cannot find information..
this is what I now have, in Maui:
public class StrikeThroughLabelHandler : LabelHandler
{
protected override void ConnectHandler(AppCompatTextView platformView)
{
base.ConnectHandler(platformView);
// && Element != null) TO ADD
if (platformView != null)
{
platformView.Text += ' ';
platformView.PaintFlags = platformView.PaintFlags
| PaintFlags.StrikeThruText;
}
}
}
Also when doing this:
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
var label = (TextView)Control;
var status = ((BackgroundLabel)e.NewElement).Status;
}
I can do e. but using the handler I have no way to do this, not that I know of atleast..
Thanks in advance