コード例 #1
0
        //public override CoreGraphics.CGSize IntrinsicContentSize => new CGSize (150, 100);

        public PlaylistsView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            var scrollView = new NSScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            OutlineView                     = new NSOutlineView();
            OutlineView.HeaderView          = null;
            OutlineView.FloatsGroupRows     = false;
            OutlineView.BackgroundColor     = NSColor.FromRgb(245, 245, 245);
            OutlineView.IndentationPerLevel = 4;

            var outlineColumn = new NSTableColumn();

            outlineColumn.Editable = false;
            outlineColumn.MinWidth = 100;

            OutlineView.AddColumn(outlineColumn);
            OutlineView.OutlineTableColumn = outlineColumn;
            outlineColumn.Dispose();
            outlineColumn = null;

            scrollView.DocumentView = OutlineView;

            AddSubview(scrollView);

            AddConstraints(NSLayoutExtensions.FillHorizontal(scrollView, false));
            AddConstraints(NSLayoutExtensions.FillVertical(scrollView, false));
            AddConstraint(NSLayoutExtensions.MinimumWidth(this, 100));
        }
コード例 #2
0
        void RebuildConstraints()
        {
            RemoveConstraints(Constraints);

            if (cachedIsCategory)
            {
                AddConstraints(NSLayoutExtensions.FillHorizontal(TextField, false));
                AddConstraints(NSLayoutExtensions.FillVertical(TextField, false));
            }
            else
            {
                AddConstraints(NSLayoutExtensions.FillVertical(ImageView, false));
                AddConstraint(NSLayoutConstraint.Create(ImageView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ImageView, NSLayoutAttribute.Height, 1.0f, 0.0f));
                AddConstraints(NSLayoutExtensions.StackOld(StackOrientation.Horizontal, true, false, true, ImageView, TextField));
                AddConstraint(NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, ImageView, NSLayoutAttribute.Height, 1.0f, 0.0f));
                AddConstraint(NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ImageView, NSLayoutAttribute.Top, 1.0f, 0.0f));
            }
        }