private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.AtLeftOf(ContentView, 14), _imageView.AtTopOf(ContentView, 10), _imageView.AtBottomOf(ContentView, 10), _imageView.Width().EqualTo(30), _imageView.Height().EqualTo(30), _text.ToRightOf(_imageView, 10), _text.WithSameCenterY(_imageView), _text.ToLeftOf(_arrow, 10), _arrow.WithSameCenterY(ContentView), _arrow.AtRightOf(ContentView, 14), _arrow.Height().EqualTo(15), _arrow.Width().EqualTo(9), _topRuler.AtTopOf(ContentView), _topRuler.AtLeftOf(ContentView), _topRuler.AtRightOf(ContentView), _topRuler.Height().EqualTo(1) ); }
void Initialize() { iconContainer = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, }; taskIcon = new UIImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFit, }; taskNameLbl = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextAlignment = UITextAlignment.Center, Lines = 2, }; iconContainer.AddSubview(taskIcon); ContentView.AddSubviews(iconContainer, taskNameLbl); iconContainer.Height(IconMaxArea.Height); taskIcon.CenterXY(); NSLayoutConstraint constraint = null; constraint = NSLayoutConstraint.Create(iconContainer, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Left, 1, 10); ContentView.AddConstraint(constraint); constraint = NSLayoutConstraint.Create(iconContainer, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Right, 1, -10); ContentView.AddConstraint(constraint); ContentView.AddConstraint(Layout.VerticalSpacing(iconContainer, taskNameLbl)); taskNameLbl.CenterX(); ContentView.AddConstraints(Layout.PinLeftRightEdges(taskNameLbl, 10, 10)); SetupSelectedView(); }
public override void UpdateConstraints() { Console.WriteLine("Updating Constraints"); ContentView.RemoveConstraints(Constraints); ContentView.AddConstraints( // ContentView.AtLeftOf(this), // ContentView.AtRightOf(this), // ContentView.AtTopOf(this), // ContentView.AtBottomOf(this), Label1.AtTopOf(ContentView), Label1.AtLeftOf(ContentView), Label1.AtRightOf(ContentView), Label1.Height().EqualTo(Label1.Font.LineHeight), Label2.Below(Label1), Label2.AtLeftOf(ContentView), Label2.AtRightOf(ContentView), Label2.AtBottomOf(ContentView) ); base.UpdateConstraints(); }
void Initialize() { BubbleHighlightedImage = highlightedBubbleImage; BubbleImage = normalBubbleImage; ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[bubble]", (NSLayoutFormatOptions)0, "bubble", BubbleImageView)); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-2-[bubble]-2-|", (NSLayoutFormatOptions)0, "bubble", BubbleImageView )); BubbleImageView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[bubble(>=48)]", (NSLayoutFormatOptions)0, "bubble", BubbleImageView )); var vSpaceTop = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Top, 1, 10); ContentView.AddConstraint(vSpaceTop); var vSpaceBottom = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Bottom, 1, -10); ContentView.AddConstraint(vSpaceBottom); var msgLeading = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, BubbleImageView, NSLayoutAttribute.Leading, 1, 16); ContentView.AddConstraint(msgLeading); var msgCenter = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.CenterX, 1, 3); ContentView.AddConstraint(msgCenter); }
public TypeSelectorWindow(TypeSelectorViewModel viewModel) : base(new CGRect(0, 0, 300, 300), NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Resizable, NSBackingStore.Buffered, true) { Title = Properties.Resources.SelectObjectTitle; this.selector = new TypeSelectorControl { ViewModel = viewModel, TranslatesAutoresizingMaskIntoConstraints = false }; ContentView.AddSubview(this.selector); this.ok = NSButton.CreateButton(Properties.Resources.OK, OnOked); this.ok.TranslatesAutoresizingMaskIntoConstraints = false; ContentView.AddSubview(this.ok); this.cancel = NSButton.CreateButton(Properties.Resources.Cancel, OnCanceled); this.cancel.TranslatesAutoresizingMaskIntoConstraints = false; ContentView.AddSubview(this.cancel); ContentView.AddConstraints(new[] { NSLayoutConstraint.Create(this.selector, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Width, 1, -20), NSLayoutConstraint.Create(this.selector, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(this.selector, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterX, 1, 0), NSLayoutConstraint.Create(this.selector, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this.ok, NSLayoutAttribute.Top, 1, -10), NSLayoutConstraint.Create(this.ok, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Bottom, 1, -10), NSLayoutConstraint.Create(this.ok, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Right, 1, -10), NSLayoutConstraint.Create(this.cancel, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this.ok, NSLayoutAttribute.Left, 1, -10), NSLayoutConstraint.Create(this.cancel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Bottom, 1, -10), }); }
protected override void CreateConstraints() { base.CreateConstraints(); ContentView.AddConstraints( _leftView.AtLeftOf(ContentView), _leftView.AtTopOf(ContentView), _leftView.AtBottomOf(ContentView), _leftView.Height().EqualTo(IMAGE_HEIGHT + 80), _leftView.WithRelativeWidth(ContentView, 0.4f), _imgView.AtTopOf(_leftView, 3 * PADDING), _imgView.WithSameCenterX(_leftView), _imgView.Width().EqualTo(IMAGE_WIDTH), _imgView.Height().EqualTo(IMAGE_HEIGHT), _lblCategory.Below(_imgView, PADDING), _lblCategory.WithSameLeft(_imgView), _lblCategory.WithSameWidth(_leftView), _rightView.AtRightOf(ContentView), _rightView.AtTopOf(ContentView), _rightView.AtBottomOf(ContentView), _rightView.WithRelativeWidth(ContentView, 0.6f), _rightView.WithSameHeight(_leftView), _lblName.AtLeftOf(_rightView, PADDING), _lblName.AtTopOf(_rightView, 3 * PADDING), _lblName.AtRightOf(_rightView, PADDING), _lblDesc.Below(_lblName, PADDING), _lblDesc.AtLeftOf(_rightView, PADDING), _lblDesc.AtRightOf(_rightView, PADDING) ); }
private void CreateLayout() { LayoutMargins = UIEdgeInsets.Zero; BackgroundColor = UIColor.White; SelectionStyle = UITableViewCellSelectionStyle.None; NameLabel = new UILabel() { Font = UIFont.SystemFontOfSize(20, UIFontWeight.Bold) }; ObservationsLabel = new UILabel() { Lines = 0 }; ContentView.AddSubviews(NameLabel, ObservationsLabel); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( NameLabel.AtTopOf(ContentView, 8), NameLabel.AtLeftOf(ContentView, 8), NameLabel.AtRightOf(ContentView, 8), ObservationsLabel.Below(NameLabel, 8), ObservationsLabel.WithSameLeft(NameLabel), ObservationsLabel.WithSameRight(NameLabel), ObservationsLabel.AtBottomOf(ContentView, 8) ); }
public override void LayoutSubviews() { base.LayoutSubviews(); ContentView.Add(_startDate); ContentView.Add(_endDate); ContentView.Add(_approverFullName); ContentView.Add(_status); ContentView.Add(_type); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _startDate.WithSameTop(ContentView), _startDate.WithSameLeft(ContentView).Plus(80), _startDate.WithSameHeight(ContentView), _endDate.ToRightOf(_startDate, 6), _endDate.WithSameTop(_startDate), _endDate.WithSameWidth(_startDate), _endDate.WithSameHeight(_startDate), _approverFullName.ToRightOf(_endDate, 6), _approverFullName.WithSameTop(_startDate), _approverFullName.WithSameHeight(_startDate), _status.ToRightOf(_approverFullName, 6), _status.WithSameTop(_startDate), _status.WithSameHeight(_startDate), _type.ToRightOf(_status, 6), _type.WithSameTop(_startDate), _type.WithSameHeight(_startDate) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _text.AtLeftOf(ContentView, 14), _text.WithSameCenterY(ContentView), _ruler.AtTopOf(ContentView), _ruler.AtRightOf(ContentView), _ruler.AtLeftOf(ContentView), _ruler.Height().EqualTo(1), _arrowImage.AtRightOf(ContentView, 14), _arrowImage.Height().EqualTo(15), _arrowImage.Width().EqualTo(9), _arrowImage.WithSameCenterY(ContentView), _text.AtRightOf(_arrowImage, 5), _bottomRuler.AtBottomOf(ContentView), _bottomRuler.AtLeftOf(ContentView), _bottomRuler.AtRightOf(ContentView), _bottomRuler.Height().EqualTo(1), ContentView.Height().EqualTo(50) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _topRuler.AtTopOf(ContentView), _topRuler.AtRightOf(ContentView, 0), _topRuler.AtLeftOf(ContentView, 0), _topRuler.Height().EqualTo(1), _bottomRuler.AtBottomOf(ContentView), _bottomRuler.AtRightOf(ContentView), _bottomRuler.AtLeftOf(ContentView), _bottomRuler.Height().EqualTo(1), _avatar.AtTopOf(ContentView, 10), _avatar.AtLeftOf(ContentView, 10), _avatar.Height().EqualTo(50), _avatar.Width().EqualTo(50), _avatar.AtBottomOf(ContentView, 10), _displayName.WithSameCenterY(_avatar), _displayName.ToRightOf(_avatar, 10) ); }
void Initialize() { BubbleHighlightedImage = highlightedBubbleImage; BubbleImg = normalBubbleImage; ContentView.AddConstraint(Layout.PinRightEdge(ContentView, BubbleView)); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-2-[bubble]-2-|", NSLayoutFormatOptions.DirectionLeftToRight, "bubble", BubbleView )); BubbleView.AddConstraint(Layout.WidthMin(BubbleView, 48)); var vSpaceTop = NSLayoutConstraint.Create(MessageLbl, NSLayoutAttribute.Top, NSLayoutRelation.Equal, BubbleView, NSLayoutAttribute.Top, 1, 10); ContentView.AddConstraint(vSpaceTop); var vSpaceBottom = NSLayoutConstraint.Create(MessageLbl, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, BubbleView, NSLayoutAttribute.Bottom, 1, -10); ContentView.AddConstraint(vSpaceBottom); var msgTrailing = NSLayoutConstraint.Create(MessageLbl, NSLayoutAttribute.Trailing, NSLayoutRelation.LessThanOrEqual, BubbleView, NSLayoutAttribute.Trailing, 1, -16); ContentView.AddConstraint(msgTrailing); var msgCenter = NSLayoutConstraint.Create(MessageLbl, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, BubbleView, NSLayoutAttribute.CenterX, 1, -3); ContentView.AddConstraint(msgCenter); }
void Initialize() { BubbleHighlightedImage = highlightedBubbleImage; BubbleImage = normalBubbleImage; ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[bubble]|", 0, "bubble", BubbleImageView)); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-2-[bubble]-2-|", 0, "bubble", BubbleImageView )); BubbleImageView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[bubble(>=48)]", 0, "bubble", BubbleImageView )); var vSpaceTop = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Top, 1, 10); ContentView.AddConstraint(vSpaceTop); var vSpaceBottom = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Bottom, 1, -10); ContentView.AddConstraint(vSpaceBottom); var msgTrailing = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Trailing, NSLayoutRelation.LessThanOrEqual, BubbleImageView, NSLayoutAttribute.Trailing, 1, -16); ContentView.AddConstraint(msgTrailing); var msgCenter = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.CenterX, 1, -3); ContentView.AddConstraint(msgCenter); MessageLabel.TextColor = UIColor.White; }
public TextFieldCell(IntPtr handle) : base(handle) { SelectionStyle = UITableViewCellSelectionStyle.None; ContentView.BackgroundColor = UIColor.Clear; BackgroundColor = UIColor.Clear; var textFieldHeight = 44; textField = new UITextField { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.White, LeftView = new UIView(new CGRect(0, 0, 25, 20)), LeftViewMode = UITextFieldViewMode.Always }; textField.Layer.CornerRadius = textFieldHeight / 2; textField.Layer.BorderColor = UIColor.Clear.CGColor; var views = new NSDictionary(new NSString("textField"), textField); var metrics = new NSDictionary(new NSString("tfh"), textFieldHeight); ContentView.Add(textField); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-20-[textField]-20-|", 0, metrics, views)); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-10-[textField(tfh)]-10-|", 0, metrics, views)); }
public SuggestionTableViewCell(IntPtr ptr) : base(ptr) { textContentView = new UIView(); projectLabel = new UILabel().Apply(Style.Recent.CellProjectLabel); clientLabel = new UILabel().Apply(Style.Recent.CellClientLabel); descriptionLabel = new UILabel().Apply(Style.Recent.CellDescriptionLabel); textContentView.AddSubviews(projectLabel, clientLabel, descriptionLabel); ContentView.AddSubview(textContentView); ContentView.AddConstraints(new FluentLayout[] { textContentView.AtTopOf(ContentView), textContentView.AtBottomOf(ContentView), textContentView.AtLeftOf(ContentView), textContentView.AtRightOf(ContentView) }.ToLayoutConstraints()); textContentView.AddConstraints(new FluentLayout[] { projectLabel.AtTopOf(textContentView, 8), projectLabel.AtLeftOf(textContentView, HorizPadding), clientLabel.WithSameCenterY(projectLabel).Plus(1), clientLabel.ToRightOf(projectLabel, 6), clientLabel.AtRightOf(textContentView, HorizPadding), descriptionLabel.Below(projectLabel, 4), descriptionLabel.AtLeftOf(textContentView, HorizPadding + 1), descriptionLabel.AtRightOf(textContentView, HorizPadding) }.ToLayoutConstraints()); textContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _buttonCenterConstraint = _viewButton.WithSameCenterX(ContentView).ToLayoutConstraints().First(); _buttonRightConstraint = _viewButton.AtRightOf(ContentView, 14).ToLayoutConstraints().First(); ContentView.AddConstraints( _background.AtLeftOf(ContentView), _background.AtRightOf(ContentView), _background.AtTopOf(ContentView), _background.AtBottomOf(ContentView), _name.AtLeftOf(ContentView, 14), _name.AtRightOf(ContentView, 14), _name.AtTopOf(ContentView, 30), GroupDescription.Below(_name, 14), GroupDescription.AtLeftOf(ContentView, 14), GroupDescription.AtRightOf(ContentView, 14), _viewButton.AtBottomOf(ContentView, 25), _viewButton.Width().EqualTo(130), _viewButton.Height().EqualTo(40), _ruler.AtBottomOf(ContentView), _ruler.AtLeftOf(ContentView), _ruler.AtRightOf(ContentView), _ruler.Height().EqualTo(1) ); }
public ButtonCell() { SelectionStyle = UITableViewCellSelectionStyle.None; ContentView.BackgroundColor = UIColor.Clear; BackgroundColor = UIColor.Clear; var buttonHeight = 44; button = UIButton.FromType(UIButtonType.System); button.TranslatesAutoresizingMaskIntoConstraints = false; button.SetTitle("Done", UIControlState.Normal); button.SetTitleColor(UIColor.White.ColorWithAlpha(0.8f), UIControlState.Normal); button.Font = UIFont.FromName(button.Font.Name, 20); //button.Layer.CornerRadius = buttonHeight / 2; //button.Layer.BorderColor = UIColor.Clear.CGColor; var views = new NSDictionary("button", button); var metrics = new NSDictionary(new NSString("bh"), buttonHeight); ContentView.Add(button); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-35-[button]-35-|", 0, metrics, views)); ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-10-[button(bh)]-10-|", 0, metrics, views)); ActionStream = button.RXTouchUpInside(); }
public override void LoadView() { View = new DetailsItemView(); ContentView.AddSubview(View); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints(View.FullSizeOf(ContentView)); }
protected override void SetupConstraints() { ContentView.AddSubviews(_imageView); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.InsideOf(ContentView, DefaultPadding) ); }
public override void LoadView() { View = new VacationTableHeaderView(); ContentView.NotNull().AddSubview(View); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints(View.FullSizeOf(ContentView)); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _backPanel.AtTopOf(ContentView, 5), _backPanel.AtBottomOf(ContentView, 5), _backPanel.AtRightOf(ContentView, 0), _backPanel.AtLeftOf(ContentView, 0), _backPanel.Height().GreaterThanOrEqualTo(40), _topBorder.AtTopOf(_backPanel), _topBorder.AtLeftOf(_backPanel), _topBorder.AtRightOf(_backPanel), _topBorder.Height().EqualTo(1), _bottomBorder.AtBottomOf(_backPanel), _bottomBorder.AtLeftOf(_backPanel), _bottomBorder.AtRightOf(_backPanel), _bottomBorder.Height().EqualTo(1), _avatarImage.Below(_topBorder, 14), _avatarImage.AtLeftOf(_backPanel, 14), _avatarImage.Height().EqualTo(45), _avatarImage.Width().EqualTo(45), _displayName.WithSameCenterY(_avatarImage).Plus(-13), _displayName.ToRightOf(_avatarImage, 10), _displayName.AtRightOf(_backPanel, 13), _timeAgo.Below(_displayName, 3), _timeAgo.WithSameLeft(_displayName), _timeAgo.WithSameRight(_displayName), _contentContainer.Below(_avatarImage, 10), _contentContainer.WithSameLeft(_avatarImage), _contentContainer.WithSameRight(_displayName), _contentContainer.Height().GreaterThanOrEqualTo(30), _ruler.Below(_contentContainer, 15), _ruler.Height().EqualTo(1), _ruler.WithSameLeft(_avatarImage), _ruler.WithSameRight(_displayName), _commentButton.Below(_ruler), _commentButton.WithSameLeft(_avatarImage), _commentButton.Above(_bottomBorder), _commentButton.Height().EqualTo(50), _likeButton.WithSameCenterY(_commentButton), _likeButton.ToRightOf(_commentButton, 15), _likeButton.WithSameHeight(_commentButton) ); // This call does not set the property on the child views of child views so we call this on the content container as well _contentContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); _contentContainer.AddConstraints(AddContentConstraints(_contentContainer)); }
public ContentItemCell(DisplayContext displayContext, IContentItem contentItem, string cellId) : base(UITableViewCellStyle.Default, cellId) { var contentItemView = displayContext.ViewFactory.CreateContentItemView(contentItem); contentItemView.TranslatesAutoresizingMaskIntoConstraints = false; ContentView.AddSubview(contentItemView); ContentView.AddConstraints(ContentConstraints(contentItemView, ContentView)); }
public override void UpdateConstraints() { if (!NeedsUpdateConstraints()) { return; } base.UpdateConstraints(); var metrics = new object[] { "image", _image, "rootmargin", 2, "imagemargin", 10, "labelmargin", 5, "label", _label, "root", _root, }; var rootH1 = NSLayoutConstraint.FromVisualFormat( "H:|-rootmargin-[root]-rootmargin-|", NSLayoutFormatOptions.DirectionLeftToRight, metrics ); var rootV1 = NSLayoutConstraint.FromVisualFormat( "V:|-rootmargin-[root]-rootmargin-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics ); ContentView.AddConstraints(rootH1); ContentView.AddConstraints(rootV1); var consH1 = NSLayoutConstraint.FromVisualFormat( "H:|-imagemargin-[image]-imagemargin-|", NSLayoutFormatOptions.AlignAllCenterX, metrics ); var consH2 = NSLayoutConstraint.FromVisualFormat( "H:|-labelmargin-[label]-labelmargin-|", NSLayoutFormatOptions.AlignAllCenterX, metrics ); var consV1 = NSLayoutConstraint.FromVisualFormat( "V:|-imagemargin-[image]-labelmargin-[label(20)]-labelmargin-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics ); _root.AddConstraints(consV1); _root.AddConstraints(consH1); _root.AddConstraints(consH2); }
public override void UpdateConstraints() { if (ContentView.Constraints.Length > 0) { base.UpdateConstraints(); return; } ContentView.AddConstraints( colorBox.AtLeftOf(ContentView, 0f), colorBox.AtTopOf(ContentView, 10f), colorBox.AtBottomOf(ContentView, 10f), colorBox.Width().EqualTo(3f), startBtn.AtRightOf(ContentView, 15f), startBtn.WithSameCenterY(ContentView), startBtn.Height().EqualTo(35f), startBtn.Width().EqualTo(35f), timeLabel.WithSameCenterY(ContentView), timeLabel.ToLeftOf(startBtn, 10f), timeLabel.Width().EqualTo(timeLabel.Bounds.Width), textContentView.AtLeftOf(ContentView, 50f), textContentView.ToLeftOf(timeLabel, 5f), textContentView.WithSameCenterY(ContentView), textContentView.WithSameHeight(ContentView) ); textContentView.AddConstraints( projectLabel.AtLeftOf(textContentView, 0f) ); if (data.IsEmpty) { textContentView.AddConstraints( projectLabel.WithSameCenterY(textContentView), null ); } else { textContentView.AddConstraints( projectLabel.AtTopOf(textContentView, 10f), descriptionLabel.WithSameLeft(projectLabel), descriptionLabel.Below(projectLabel, 0f), descriptionLabel.AtBottomOf(textContentView, 10f), null ); } base.UpdateConstraints(); LayoutIfNeeded(); }
public override void LoadView() { View = new MenuFilterItemView(); ContentView.AddSubview(View); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints(View.FullSizeOf(ContentView)); SelectionStyle = UIKit.UITableViewCellSelectionStyle.None; }
public override void LoadView() { View = new VacationItemView(); ContentView.NotNull().AddSubview(View); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints(View.FullSizeOf(ContentView)); this.SelectionStyle = UITableViewCellSelectionStyle.None; }
/// <summary> /// Initializes a new instance of the <see cref="T:MatchDayManagement.iOS.InjurySearchResultTableViewCell"/> class. /// </summary> /// <param name="handle">Handle.</param> protected ContactTableViewCell(IntPtr handle) : base(handle) { _titleLabel = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("Helvetica", 16f), TextColor = UIColor.Clear.FromHex("#444444"), }; _iconImageView = new UIImageView() { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFit, }; _leftView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear.FromHex("#ca505d") }; var views = new DictionaryViews() { { "titleLabel", _titleLabel }, { "iconImageView", _iconImageView }, }; ContentView.Add(_titleLabel); ContentView.Add(_iconImageView); ContentView.AddConstraints( NSLayoutConstraint.FromVisualFormat("V:|-5-[titleLabel]-5-|", NSLayoutFormatOptions.DirectionLeftToRight, null, views) .Concat(NSLayoutConstraint.FromVisualFormat("V:|-10-[iconImageView]-10-|", NSLayoutFormatOptions.DirectionLeftToRight, null, views)) .Concat(NSLayoutConstraint.FromVisualFormat("H:|-18-[iconImageView(20)]-5-[titleLabel]-15-|", NSLayoutFormatOptions.AlignAllTop, null, views)) .ToArray()); // selected view SelectedBackgroundView = new UIView(ContentView.Bounds) { BackgroundColor = UIColor.Clear.FromHex("#fefafa"), }; SelectedBackgroundView.Add(_leftView); var selectedViews = new DictionaryViews() { { "leftView", _leftView } }; SelectedBackgroundView.AddConstraints( NSLayoutConstraint.FromVisualFormat("V:|[leftView]|", NSLayoutFormatOptions.DirectionLeftToRight, null, selectedViews) .Concat(NSLayoutConstraint.FromVisualFormat("H:|[leftView(3)]", NSLayoutFormatOptions.AlignAllTop, null, selectedViews)) .ToArray()); }
void ConstrainCell() { ContentView.AddSubview(_logInfo); ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _logInfo.Leading().EqualTo(5).LeadingOf(ContentView), _logInfo.Trailing().EqualTo(-5).TrailingOf(ContentView), _logInfo.Top().EqualTo().TopOf(ContentView), _logInfo.Bottom().EqualTo().BottomOf(ContentView) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _imageView.AtTopOf(ContentView), _imageView.AtLeftOf(ContentView), _imageView.AtBottomOf(ContentView), _imageView.AtRightOf(ContentView) ); }
protected override void CreateConstraints() { base.CreateConstraints(); ContentView.AddConstraints( _lblName.AtLeftOf(ContentView, PADDING), _lblName.AtTopOf(ContentView, PADDING), _lblName.AtBottomOf(ContentView, PADDING), _lblName.AtRightOf(ContentView, PADDING) ); }
private void SetupConstraints() { ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); ContentView.AddConstraints( _ruler.AtTopOf(ContentView), _ruler.AtLeftOf(ContentView), _ruler.AtBottomOf(ContentView), _ruler.AtRightOf(ContentView), _ruler.Height().EqualTo(1) ); }