diff options
author | Dominique Louis <dominique@yen-x1-31.fareast.corp.microsoft.com> | 2018-12-02 11:36:19 +0300 |
---|---|---|
committer | Dominique Louis <dominique@yen-x1-31.fareast.corp.microsoft.com> | 2018-12-02 11:52:09 +0300 |
commit | 2f16fd1451e3e7c9adcca9fe852fe767834468be (patch) | |
tree | 071efa534ea30fa170ea1201bde9c01f053ad496 /Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs | |
parent | 794123986062cb0a8ab2885bbb449bb62f9f13ad (diff) |
[Mac] Remove DoConstraints dependency and use NSLayoutConstraint.Create calls directly. Should be slightly faster on startup.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs b/Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs index 3c6942b..4ac1973 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/CustomExpressionView.cs @@ -23,23 +23,23 @@ namespace Xamarin.PropertyEditing.Mac TranslatesAutoresizingMaskIntoConstraints = false, }; - vmType = viewModel.GetType (); - customExpressionPropertyInfo = vmType.GetProperty (CustomExpressionPropertyString); - var value = customExpressionPropertyInfo.GetValue (viewModel); + this.vmType = viewModel.GetType (); + this.customExpressionPropertyInfo = vmType.GetProperty (CustomExpressionPropertyString); + var value = this.customExpressionPropertyInfo.GetValue (viewModel); if (value != null) customExpressionField.StringValue = (string)value; customExpressionField.Activated += (sender, e) => { - customExpressionPropertyInfo.SetValue (viewModel, customExpressionField.StringValue); + this.customExpressionPropertyInfo.SetValue (viewModel, customExpressionField.StringValue); }; AddSubview (customExpressionField); - this.DoConstraints (new[] { - customExpressionField.ConstraintTo (this, (s, c) => s.Top == c.Top + 37), - customExpressionField.ConstraintTo (this, (s, c) => s.Left == c.Left + 38), - customExpressionField.ConstraintTo (this, (s, c) => s.Width == c.Width - 57), - customExpressionField.ConstraintTo (this, (s, c) => s.Height == 24), + this.AddConstraints (new[] { + NSLayoutConstraint.Create (customExpressionField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 37f), + NSLayoutConstraint.Create (customExpressionField, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 38f), + NSLayoutConstraint.Create (customExpressionField, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, -57f), + NSLayoutConstraint.Create (customExpressionField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, PropertyEditorControl.DefaultControlHeight), }); } } |