parent
8322ddaae3
commit
db417111fd
|
@ -6,13 +6,21 @@ namespace Ooui.Forms
|
|||
public class LinkLabel : Xamarin.Forms.Label
|
||||
{
|
||||
public static readonly BindableProperty HRefProperty = BindableProperty.Create ("HRef", typeof (string),
|
||||
typeof (LinkView), string.Empty, BindingMode.OneWay, null, null, null, null);
|
||||
typeof (LinkLabel), string.Empty, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
public string HRef {
|
||||
get { return (string)base.GetValue (HRefProperty); }
|
||||
set { base.SetValue (HRefProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly BindableProperty TargetProperty = BindableProperty.Create ("Target", typeof (string),
|
||||
typeof (LinkLabel), string.Empty, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
public string Target {
|
||||
get { return (string)base.GetValue (TargetProperty); }
|
||||
set { base.SetValue (TargetProperty, value); }
|
||||
}
|
||||
|
||||
public LinkLabel ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,6 +13,14 @@ namespace Ooui.Forms
|
|||
set { base.SetValue (HRefProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly BindableProperty TargetProperty = BindableProperty.Create ("Target", typeof (string),
|
||||
typeof (LinkView), string.Empty, BindingMode.OneWay, null, null, null, null);
|
||||
|
||||
public string Target {
|
||||
get { return (string)base.GetValue (TargetProperty); }
|
||||
set { base.SetValue (TargetProperty, value); }
|
||||
}
|
||||
|
||||
public LinkView ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace Ooui.Forms.Renderers
|
|||
}
|
||||
|
||||
UpdateHRef ();
|
||||
UpdateTarget ();
|
||||
|
||||
UpdateText ();
|
||||
UpdateTextColor ();
|
||||
|
@ -107,6 +108,11 @@ namespace Ooui.Forms.Renderers
|
|||
Control.HRef = Element.HRef;
|
||||
}
|
||||
|
||||
void UpdateTarget ()
|
||||
{
|
||||
Control.Target = Element.HRef;
|
||||
}
|
||||
|
||||
void UpdateAlignment ()
|
||||
{
|
||||
this.Style.Display = "table";
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Ooui.Forms.Renderers
|
|||
base.OnElementChanged (e);
|
||||
|
||||
UpdateHRef ();
|
||||
UpdateTarget ();
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
|
||||
|
@ -24,13 +25,20 @@ namespace Ooui.Forms.Renderers
|
|||
if (Control == null)
|
||||
return;
|
||||
|
||||
if (e.PropertyName == Ooui.Forms.LinkLabel.HRefProperty.PropertyName)
|
||||
if (e.PropertyName == Ooui.Forms.LinkView.HRefProperty.PropertyName)
|
||||
UpdateHRef ();
|
||||
if (e.PropertyName == Ooui.Forms.LinkView.TargetProperty.PropertyName)
|
||||
UpdateTarget ();
|
||||
}
|
||||
|
||||
void UpdateHRef ()
|
||||
{
|
||||
this.SetAttribute ("href", Element.HRef);
|
||||
}
|
||||
|
||||
void UpdateTarget ()
|
||||
{
|
||||
this.SetAttribute ("target", Element.Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@ namespace Ooui
|
|||
set => SetAttributeProperty ("href", value);
|
||||
}
|
||||
|
||||
public string Target {
|
||||
get => GetStringAttribute ("target", "");
|
||||
set => SetAttributeProperty ("target", value);
|
||||
}
|
||||
|
||||
public Anchor ()
|
||||
: base ("a")
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue