/// <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; }
/// <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; }
/// <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(); }
/// <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 (); }
/// <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; }
/// <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; }