Exemplo n.º 1
0
		/// <summary>
		/// Initializes a new instance of UITableView.
		/// </summary>
		/// <param name="data">Source Data.</param>
		/// <param name="cellHeight">cellHeight, use 0 for default.</param>
		/// <param name="fSize">Cell Font size.</param>
		/// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
		/// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
		public DropDownTable(IList<string> data, nfloat cellHeight,
			nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor,
			string selectedText = "") : base()
		{
			CellLayoutMarginsFollowReadableWidth = false;
			this.MultipleTouchEnabled = true;
			this._FontSize = fSize;
			this._CellHeight = cellHeight;
			this._CellSBackgroundColor = cellSelectedBackgroundColor;
			this._CellSTextColor = cellSelectedTextColor;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, 
				this._CellSTextColor, selectedText);

			//ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
			LayoutMargins = UIEdgeInsets.Zero;
			SeparatorInset = UIEdgeInsets.Zero;

			// select default row
			var idx = data.ToList().FindIndex(x => x == selectedText);
			System.Diagnostics.Debug.WriteLine (idx);
			if (idx >= 0) {
				this.SelectRow (Foundation.NSIndexPath.FromItemSection (idx, 0), false, UITableViewScrollPosition.Top);
			}

			(Source as DropDownSource).OnSelected += RowSelected;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of UITableView.
        /// </summary>
        /// <param name="data">Source Data.</param>
        /// <param name="cellHeight">cellHeight, use 0 for default.</param>
        /// <param name="fSize">Cell Font size.</param>
        /// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
        /// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
        public DropDownTable(IList <string> data, nfloat cellHeight,
                             nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor,
                             string selectedText = "") : base()
        {
            CellLayoutMarginsFollowReadableWidth = false;
            this.MultipleTouchEnabled            = true;
            this._FontSize             = fSize;
            this._CellHeight           = cellHeight;
            this._CellSBackgroundColor = cellSelectedBackgroundColor;
            this._CellSTextColor       = cellSelectedTextColor;

            Source = new DropDownSource(data, this._FontSize, this._CellHeight, this._CellSBackgroundColor,
                                        this._CellSTextColor, selectedText);

            //ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
            LayoutMargins  = UIEdgeInsets.Zero;
            SeparatorInset = UIEdgeInsets.Zero;

            // select default row
            var idx = data.ToList().FindIndex(x => x == selectedText);

            System.Diagnostics.Debug.WriteLine(idx);
            if (idx >= 0)
            {
                this.SelectRow(Foundation.NSIndexPath.FromItemSection(idx, 0), false, UITableViewScrollPosition.Top);
            }

            (Source as DropDownSource).OnSelected += RowSelected;
        }
Exemplo n.º 3
0
        /// <summary>
        /// reload the data
        /// </summary>
        /// <param name="data">Data.</param>
        public void ReloadSource(IList <string> data)
        {
            // events must be removed and reattached
            (Source as DropDownSource).OnSelected -= RowSelected;

            Source = new DropDownSource(data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, this._CellSTextColor);

            (Source as DropDownSource).OnSelected += RowSelected;
            this.ReloadData();
        }
Exemplo n.º 4
0
		/// <summary>
		/// reload the data
		/// </summary>
		/// <param name="data">Data.</param>
		public void ReloadSource(IList<string> data)
		{
			// events must be removed and reattached
			(Source as DropDownSource).OnSelected -= RowSelected;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, this._CellSTextColor);

			(Source as DropDownSource).OnSelected += RowSelected;
			this.ReloadData ();
		}
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of UITableView.
        /// </summary>
        /// <param name="data">Source Data.</param>
        /// <param name="cellHeight">cellHeight, use 0 for default.</param>
        /// <param name="fSize">Cell Font size.</param>
        /// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
        /// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
        public DropDownTable(IList <string> data, nfloat cellHeight,
                             nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor) : base()
        {
            CellLayoutMarginsFollowReadableWidth = false;
            this.MultipleTouchEnabled            = true;
            this._FontSize             = fSize;
            this._CellHeight           = cellHeight;
            this._CellSBackgroundColor = cellSelectedBackgroundColor;
            this._CellSTextColor       = cellSelectedTextColor;

            Source = new DropDownSource(data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, this._CellSTextColor);
            //ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
            LayoutMargins  = UIEdgeInsets.Zero;
            SeparatorInset = UIEdgeInsets.Zero;

            (Source as DropDownSource).OnSelected += RowSelected;
        }
Exemplo n.º 6
0
		/// <summary>
		/// Initializes a new instance of UITableView.
		/// </summary>
		/// <param name="data">Source Data.</param>
		/// <param name="cellHeight">cellHeight, use 0 for default.</param>
		/// <param name="fSize">Cell Font size.</param>
		/// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
		/// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
		public DropDownTable(IList<string> data, nfloat cellHeight,
			nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor) : base()
		{
			CellLayoutMarginsFollowReadableWidth = false;
			this.MultipleTouchEnabled = true;
			this._FontSize = fSize;
			this._CellHeight = cellHeight;
			this._CellSBackgroundColor = cellSelectedBackgroundColor;
			this._CellSTextColor = cellSelectedTextColor;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, this._CellSTextColor);
			//ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
			LayoutMargins = UIEdgeInsets.Zero;
			SeparatorInset = UIEdgeInsets.Zero;

			(Source as DropDownSource).OnSelected += RowSelected;
		}