Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Medrano <josmed@microsoft.com>2019-09-30 13:36:16 +0300
committerJose Medrano <josmed@microsoft.com>2019-09-30 13:38:58 +0300
commit9099c66f4f7e12d36ff0a71fe4aeb52f13c62bac (patch)
treecc43c5cf0dd969d3b6787a974a7e26c16fa5c930
parented0fd4bb300aee3e5b45b15282cfad39d2a8dff2 (diff)
Some constraints changes based in current ControlSizetests
-rw-r--r--Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs34
1 files changed, 26 insertions, 8 deletions
diff --git a/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs
index 7e96dde..fc3996d 100644
--- a/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs
+++ b/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs
@@ -150,9 +150,7 @@ namespace Xamarin.PropertyEditing.Mac
};
AddSubview (this.header);
- this.border = new DynamicBox (HostResourceProvider, NamedResources.TabBorderColor) {
- Frame = new CGRect (0, 0, 1, 1)
- };
+ this.border = new DynamicBox (HostResourceProvider, NamedResources.TabBorderColor);
header.AddSubview (this.border);
this.propertyFilter = new NSSearchField {
@@ -177,15 +175,20 @@ namespace Xamarin.PropertyEditing.Mac
};
AddSubview (this.propertyList);
+ var propertyPanelWidth = (nfloat)Math.Max (Frame.Width, 1);
+ headerWidthConstraint = NSLayoutConstraint.Create (this.header, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, propertyPanelWidth);
+ propertyListWidthConstraint = NSLayoutConstraint.Create (this.propertyList, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, propertyPanelWidth);
+ propertyListHeightConstraint = NSLayoutConstraint.Create (this.propertyList, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, (nfloat)Math.Max (Frame.Height, 1));
+
+
this.AddConstraints (new[] {
+ NSLayoutConstraint.Create (this.header, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1, 0),
NSLayoutConstraint.Create (this.header, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1, 0),
- NSLayoutConstraint.Create (this.header, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1, 0),
- NSLayoutConstraint.Create (this.header, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 30),
+ headerWidthConstraint,
NSLayoutConstraint.Create (this.tabStack, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Left, 1, 0),
NSLayoutConstraint.Create (this.tabStack, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Top, 1, 0),
NSLayoutConstraint.Create (this.tabStack, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Bottom, 1, 0),
- NSLayoutConstraint.Create (this.tabStack, NSLayoutAttribute.Right, NSLayoutRelation.LessThanOrEqual, this.propertyFilter, NSLayoutAttribute.Left, 1, 0),
NSLayoutConstraint.Create (this.propertyFilter, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Right, 1, -15),
NSLayoutConstraint.Create (this.propertyFilter, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, 150),
@@ -193,15 +196,30 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (this.border, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Bottom, 1, 0),
NSLayoutConstraint.Create (this.border, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Width, 1, 0),
+ NSLayoutConstraint.Create (this.border, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this.header, NSLayoutAttribute.Height, 1, 0),
NSLayoutConstraint.Create (this.propertyList, NSLayoutAttribute.Top, NSLayoutRelation.Equal, border, NSLayoutAttribute.Bottom, 1, 0),
- NSLayoutConstraint.Create (this.propertyList, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this, NSLayoutAttribute.Bottom, 1, 0),
- NSLayoutConstraint.Create (this.propertyList, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1, 0),
+ propertyListWidthConstraint,
+ propertyListHeightConstraint
});
UpdateResourceProvider ();
}
+ const float HeaderHeight = 30;
+ NSLayoutConstraint headerWidthConstraint, propertyListWidthConstraint, propertyListHeightConstraint;
+
+ public override void SetFrameSize (CGSize newSize)
+ {
+ base.SetFrameSize (newSize);
+ propertyListHeightConstraint.Constant = (nfloat)Math.Max (newSize.Height - HeaderHeight, 1);
+
+ //our minimun size is tabStack + small margin + property filter
+ var minimumSize = tabStack.Frame.Width + 30 + propertyFilter.Frame.Width;
+ var calculatedWidth = (nfloat) Math.Max (minimumSize, newSize.Width);
+ propertyListWidthConstraint.Constant = headerWidthConstraint.Constant = calculatedWidth;
+ }
+
public sealed override void ViewDidChangeEffectiveAppearance ()
{
base.ViewDidChangeEffectiveAppearance ();