public override void LoadContent() { base.LoadContent(); //create the stack layout that will hold all the droplist items _stack = new StackLayout() { Alignment = StackAlignment.Top, Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Top, }; //Add all the items to the stack layout foreach (var item in DropdownWidget.DropdownItems) { _stack.AddItem(item.DeepCopy()); } //create the scroll layout and add the stack _layout = new ScrollLayout() { Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Top, Size = new Vector2(DropdownWidget.Rect.Width, ResolutionBuddy.Resolution.ScreenArea.Bottom - DropdownWidget.Rect.Bottom) }; _layout.Position = new Point(DropdownWidget.Rect.Left, DropdownWidget.Rect.Bottom); _layout.AddItem(_stack); AddItem(_layout); }
public override void LoadContent() { base.LoadContent(); var stack = new StackLayout() { Alignment = StackAlignment.Top, Position = new Point(LeftRight ? Resolution.TitleSafeArea.Left : Resolution.TitleSafeArea.Right, 0), Horizontal = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right, Vertical = VerticalAlignment.Top, }; //first add the menu item to dismiss the screen CreateButton(new ContextMenuItem(HamburgerIcon, "", ((obj, e) => { ExitScreen(); })), stack); //add each menu item below this foreach (var hamburgerItem in HamburgerItems) { CreateButton(hamburgerItem, stack); } //create the scroll layout var scroll = new ScrollLayout() { Position = new Point(LeftRight ? Resolution.ScreenArea.Left : Resolution.ScreenArea.Right, Resolution.TitleSafeArea.Top), Horizontal = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right, Vertical = VerticalAlignment.Top, TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop), Size = new Vector2(Resolution.TitleSafeArea.Left + stack.Rect.Width, Math.Min(stack.Rect.Height, (Resolution.ScreenArea.Bottom - Resolution.TitleSafeArea.Top))) }; scroll.AddItem(stack); AddItem(scroll); }
public override void LoadContent() { base.LoadContent(); _stack = new StackLayout() { Alignment = StackAlignment.Top, Position = Point.Zero, Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Top, }; //add each menu item below this foreach (var menuItem in ContextMenuItems) { CreateButton(menuItem, _stack); } //figure out if we should do left or right var horiz = HorizontalAlignment.Left; if ((_clickPos.X + _stack.Rect.Width) > Resolution.ScreenArea.Right) { horiz = HorizontalAlignment.Right; } //figure out if we should do top or bottom var vert = VerticalAlignment.Top; if ((_clickPos.Y + _stack.Rect.Height) > Resolution.ScreenArea.Bottom) { vert = VerticalAlignment.Bottom; foreach (var item in _stack.Items) { var transitionable = item as ITransitionable; if (null != transitionable) { transitionable.TransitionObject = new WipeTransitionObject(TransitionWipeType.PopBottom); } } } //create the scroll layout _layout = new ScrollLayout() { Position = _clickPos.ToPoint(), Horizontal = horiz, Vertical = vert, TransitionObject = new WipeTransitionObject(vert == VerticalAlignment.Top ? TransitionWipeType.PopTop : TransitionWipeType.PopBottom), Size = new Vector2(_stack.Rect.Width, _stack.Rect.Height) }; _layout.AddItem(_stack); AddItem(_layout); //set the transition object for this layout so the background will follow correctly TransitionObject = new WipeTransitionObject(vert == VerticalAlignment.Top ? TransitionWipeType.PopTop : TransitionWipeType.PopBottom); }
public override void LoadContent() { base.LoadContent(); //create the stack layout that will hold all the droplist items _rows = new StackLayout() { Alignment = StackAlignment.Top, Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Top, }; //Add all the items to the stack layout var firstRow = GetRow(); firstRow.AddItem(new NumPadButton("1", NumEditWidget)); firstRow.AddItem(new NumPadButton("2", NumEditWidget)); firstRow.AddItem(new NumPadButton("3", NumEditWidget)); _rows.AddItem(firstRow); var secondRow = GetRow(); secondRow.AddItem(new NumPadButton("4", NumEditWidget)); secondRow.AddItem(new NumPadButton("5", NumEditWidget)); secondRow.AddItem(new NumPadButton("6", NumEditWidget)); _rows.AddItem(secondRow); var thirdRow = GetRow(); thirdRow.AddItem(new NumPadButton("7", NumEditWidget)); thirdRow.AddItem(new NumPadButton("8", NumEditWidget)); thirdRow.AddItem(new NumPadButton("9", NumEditWidget)); _rows.AddItem(thirdRow); var fourthRow = GetRow(); if (AllowDecimal) { fourthRow.AddItem(new NumPadButton(".", NumEditWidget)); } else { fourthRow.AddItem(new Shim(48f, 32f)); } fourthRow.AddItem(new NumPadButton("0", NumEditWidget)); if (AllowNegative) { fourthRow.AddItem(new NumPadButton("-", NumEditWidget)); } else { fourthRow.AddItem(new Shim(48f, 32f)); } _rows.AddItem(fourthRow); var fifthhRow = GetRow(); fifthhRow.AddItem(new NumPadButton("<", NumEditWidget)); _rows.AddItem(fifthhRow); //create the scroll layout and add the stack _layout = new ScrollLayout() { Horizontal = HorizontalAlignment.Left, Vertical = VerticalAlignment.Top, Size = new Vector2((48f * 3), 32f * 5) }; _layout.Position = new Point(NumEditWidget.Rect.Left, NumEditWidget.Rect.Bottom); if (_layout.Rect.Bottom > Resolution.ScreenArea.Bottom) { _layout.Vertical = VerticalAlignment.Bottom; _layout.Position = new Point(NumEditWidget.Rect.Left, NumEditWidget.Rect.Top); } ; _layout.AddItem(_rows); AddItem(_layout); }