2017-12-28 20:01:00 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
|
|
namespace Ooui.Forms.Renderers
|
|
|
|
|
{
|
|
|
|
|
public class LinkViewRenderer : ViewRenderer<LinkView, Ooui.Anchor>
|
|
|
|
|
{
|
|
|
|
|
public LinkViewRenderer ()
|
|
|
|
|
: base ("a")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnElementChanged (ElementChangedEventArgs<LinkView> e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementChanged (e);
|
|
|
|
|
|
|
|
|
|
UpdateHRef ();
|
2018-02-02 06:52:39 +00:00
|
|
|
|
UpdateTarget ();
|
2017-12-28 20:01:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementPropertyChanged (sender, e);
|
|
|
|
|
|
|
|
|
|
if (Control == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-02-02 06:52:39 +00:00
|
|
|
|
if (e.PropertyName == Ooui.Forms.LinkView.HRefProperty.PropertyName)
|
2017-12-28 20:01:00 +00:00
|
|
|
|
UpdateHRef ();
|
2018-02-02 06:52:39 +00:00
|
|
|
|
if (e.PropertyName == Ooui.Forms.LinkView.TargetProperty.PropertyName)
|
|
|
|
|
UpdateTarget ();
|
2017-12-28 20:01:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UpdateHRef ()
|
|
|
|
|
{
|
|
|
|
|
this.SetAttribute ("href", Element.HRef);
|
|
|
|
|
}
|
2018-02-02 06:52:39 +00:00
|
|
|
|
|
|
|
|
|
void UpdateTarget ()
|
|
|
|
|
{
|
|
|
|
|
this.SetAttribute ("target", Element.Target);
|
|
|
|
|
}
|
2017-12-28 20:01:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|