Пример #1
0
        public void select_item()
        {
            _drop.Position = new Point(10, 20);
            _drop.Size     = new Vector2(30, 40);

            var target = new TestDropdownTarget("catpants");

            _drop.AddDropdownItem(new DropdownItem <TestDropdownTarget>(target, _drop)
            {
                Vertical   = VerticalAlignment.Top,
                Horizontal = HorizontalAlignment.Left,
                Size       = new Vector2(30, 40)
            });

            _drop.SelectedItem = target;

            _drop.SelectedDropdownItem.ShouldNotBeNull();
            _drop.SelectedItem.ShouldNotBeNull();
            _drop.SelectedItem.Text.ShouldBe("catpants");
        }
Пример #2
0
        private void load()
        {
            using (var bd = new DatabaseStore())
            {
                foreach (var h in bd.ObtenerHistorial(cuenta).GroupBy(ent => new { ent.FechaHora.Month, ent.FechaHora.Year }))
                {
                    seleccionMes.AddDropdownItem(new YearMonthTuple(h.Key.Year, h.Key.Month));

                    foreach (var g in h)
                    {
                        entradas.Add(g);
                    }
                }
            }

            seleccionMes.Current.Value = seleccionMes.Items.First();
        }
Пример #3
0
        public override async Task LoadContent()
        {
            await base.LoadContent();

            AddCancelButton();

            //create the dropdown widget
            var drop = new Dropdown <string>(this);

            drop.Vertical   = VerticalAlignment.Center;
            drop.Horizontal = HorizontalAlignment.Center;
            drop.Size       = new Vector2(350, 128);
            drop.Position   = Resolution.ScreenArea.Center;

            string[] words = { "cat", "pants", "buttnuts", "cat1", "pants1", "whoa", "test1", "test2" };
            foreach (var word in words)
            {
                var dropitem = new DropdownItem <string>(word, drop)
                {
                    Vertical   = VerticalAlignment.Center,
                    Horizontal = HorizontalAlignment.Center,
                    Size       = new Vector2(350, 64)
                };

                var label = new Label(word, Content, FontSize.Small)
                {
                    Vertical   = VerticalAlignment.Center,
                    Horizontal = HorizontalAlignment.Center
                };

                dropitem.AddItem(label);
                drop.AddDropdownItem(dropitem);
            }

            drop.SelectedItem = "buttnuts";

            AddItem(drop);
        }
Пример #4
0
        public void DropdownTests_AddDropdownItem()
        {
            _drop.Position = new Point(10, 20);
            _drop.Size     = new Vector2(30, 40);

            var dropitem = new DropdownItem <string>("catpants", _drop);

            dropitem.Vertical   = VerticalAlignment.Top;
            dropitem.Horizontal = HorizontalAlignment.Left;
            dropitem.Size       = new Vector2(30, 40);
            _drop.AddDropdownItem(dropitem);

            _drop.SelectedItem = "catpants";

            Assert.AreEqual(10, dropitem.Rect.X);
            Assert.AreEqual(20, dropitem.Rect.Y);
            Assert.AreEqual(30, dropitem.Rect.Width);
            Assert.AreEqual(40, dropitem.Rect.Height);
            Assert.AreEqual(HorizontalAlignment.Left, dropitem.Horizontal);
            Assert.AreEqual(VerticalAlignment.Top, dropitem.Vertical);
        }