Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PickerCells.PickerViewCell"/> class.
        /// </summary>
        /// <param name="items">Items.</param>
        public PickerViewCell(List<String> items, UITableViewCellStyle style = UITableViewCellStyle.Default)
            : base(style)
        {
            if (items != null)
            {
                var simps = new Dictionary<int,PickerViewCellComponent>();
                simps[0] = new PickerViewCellComponent()
                {
                    Width = -1,
                    Items = new List<PickerViewCellItem>()
                    {

                    }
                };

                foreach (var aItem in items)
                {
                    simps[0].Items.Add(new PickerViewCellItem()
                    {
                        SelectedValue = aItem,
                        DisplayValue = aItem,

                    });
                }

                mDataDict = simps;

            }

            SecondarySetup();
        }
        public DateTableViewSource()
        {
            mCells = new List<BasePickerCell>();

            var aCell = new DatePickerCell(UIDatePickerMode.Date,DateTime.Now)
            {
                Key = "1234",
            };
            aCell.TextLabel.Text = "Date";
            aCell.RightLabelTextAlignment = UITextAlignment.Right;
            aCell.OnItemChanged += (object sender, PickerCellArgs e) => {

                var result = e.Items;
            };

            mCells.Add(aCell);

            var someDict = new Dictionary<int,PickerViewCellComponent>();
            someDict[0] = new PickerViewCellComponent()
            {
                Width = 160,
                Items = new List<PickerViewCellItem>()
                {
                    new PickerViewCellItem()
                    {
                        SelectedValue = 1,
                        DisplayValue = "Bob",
                    },
                    new PickerViewCellItem()
                    {
                        SelectedValue = 2,
                        DisplayValue = "John",
                    },
                }
            };

            someDict[1] = new PickerViewCellComponent()
            {
                Width = 160,
                Items = new List<PickerViewCellItem>()
                {
                    new PickerViewCellItem()
                    {
                        SelectedValue = 1,
                        DisplayValue = "Dylan",
                    },
                    new PickerViewCellItem()
                    {
                        SelectedValue = 2,
                        DisplayValue = "Lennon",
                    },
                }
            };

            // 			You can also use a string list for a single component
            //			var aList = new List<String> (){ "Ringo", "John", "Paul", "George" };
            //			var pickerCell = new PickerViewCell(aList);

            var pickerCell = new PickerViewCell(someDict);
            pickerCell.TextLabel.Text = "Artist";
            pickerCell.RightLabelTextAlignment = UITextAlignment.Right;
            pickerCell.SelectedObject = new object[]{1,1};

            pickerCell.OnItemChanged += (object sender, PickerCellArgs e) => {

                var result = e.Items;
            };

            mCells.Add(pickerCell);
        }
Beispiel #3
0
        /// <summary>
        /// Sets the items.
        /// </summary>
        /// <param name="items">Items.</param>
        public void SetItems(List<String> items)
        {
            var simps = new Dictionary<int,PickerViewCellComponent>();
            simps[0] = new PickerViewCellComponent()
            {
                Width = -1,
                Items = new List<PickerViewCellItem>()
                {

                }
            };

            foreach (var aItem in items)
            {
                simps[0].Items.Add(new PickerViewCellItem()
                {
                    SelectedValue = aItem,
                    DisplayValue = aItem,

                });
            }

            mDataDict = simps;

            SecondarySetup();
        }