/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); textField = ViewHelpers.GetView <UIKit.UITextField> (nativeView); if (textField == null) { throw new InvalidOperationException("Cannot convert " + nativeView + " to UITextField"); } if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = textField.Text; placeholder = textField.Placeholder; enabled = textField.Enabled; } else { textField.Text = text; textField.Placeholder = placeholder; textField.Enabled = enabled; } textField.ValueChanged += TextField_ValueChanged; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); switchControl = ViewHelpers.GetView <UISwitch> (nativeView); if (switchControl == null) { throw new InvalidOperationException("Cannot convert " + nativeView + " to UISwitch"); } if (options.HasFlag(BindOptions.PreserveNativeProperties)) { isChecked = switchControl.On; enabled = switchControl.Enabled; } else { switchControl.On = isChecked; switchControl.Enabled = enabled; } switchControl.ValueChanged += SwitchControl_ValueChanged; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); editText = ViewHelpers.GetView <Android.Widget.EditText> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = editText.Text; placeholder = editText.Hint; enabled = editText.Enabled; } else { editText.Text = text; editText.Hint = placeholder; editText.Enabled = enabled; } editText.TextChanged += EditText_TextChanged; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); switchControl = ViewHelpers.GetView <NSButton> (nativeView); switchControl.SetButtonType(NSButtonType.Switch); switchControl.AllowsMixedState = false; if (options.HasFlag(BindOptions.PreserveNativeProperties)) { isChecked = switchControl.State == NSCellStateValue.On; enabled = switchControl.Enabled; } else { switchControl.State = isChecked ? NSCellStateValue.On : NSCellStateValue.Off; switchControl.Enabled = enabled; } switchControl.Activated += SwitchControl_Activated; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); textField = ViewHelpers.GetView <NSTextField> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = textField.StringValue; placeholder = textField.PlaceholderString; enabled = textField.Enabled; } else { textField.StringValue = text; textField.PlaceholderString = placeholder; textField.Enabled = enabled; } textField.Changed += TextField_Changed; }
public IDisposable BindToNative(object nativeView) { var view = ViewHelpers.GetView <NativeGraphicView> (nativeView); view.GraphicView = this; return(new DisposeAction(() => { if (view.GraphicView == this) { view.GraphicView = null; } })); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); this.nativeView = ViewHelpers.GetView <NativeView> (nativeView); SetStackConstraints(); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); label = ViewHelpers.GetView <UILabel> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = label.Text; } else { label.Text = text; } }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); textField = ViewHelpers.GetView <NSTextField> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { text = textField.StringValue; } else { textField.StringValue = text; } }
public void BindToNative(object native, BindOptions options = BindOptions.None) { UnbindFromNative(); map = ViewHelpers.GetView <MKMapView> (native); singleTap = new UITapGestureRecognizer(HandleTap) { NumberOfTapsRequired = 1, }; map.AddGestureRecognizer(singleTap); doubleTap = new UITapGestureRecognizer { NumberOfTapsRequired = 2, }; map.AddGestureRecognizer(doubleTap); singleTap.RequireGestureRecognizerToFail(doubleTap); map.SetRegion(MKCoordinateRegion.FromDistance( GetCoord(setRegionCoord), setRegionDistance, setRegionDistance), false); }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); button = ViewHelpers.GetView <NSButton> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { enabled = button.Enabled; text = button.Title; } else { button.Enabled = enabled; button.Title = text; } button.Activated += Button_Activated; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); switchControl = ViewHelpers.GetView <Android.Widget.Switch> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { isChecked = switchControl.Checked; enabled = switchControl.Enabled; } else { switchControl.Checked = isChecked; switchControl.Enabled = enabled; } switchControl.CheckedChange += SwitchControl_CheckedChange; }
/// <inheritdoc/> public void BindToNative(object nativeView, BindOptions options = BindOptions.None) { if (nativeView == null) { throw new ArgumentNullException("nativeView"); } UnbindFromNative(); button = ViewHelpers.GetView <UIButton> (nativeView); if (options.HasFlag(BindOptions.PreserveNativeProperties)) { enabled = button.Enabled; text = button.Title(UIControlState.Normal); } else { button.Enabled = enabled; button.SetTitle(text, UIControlState.Normal); } button.TouchUpInside += Button_TouchUpInside; }