public override void ViewDidLoad() { base.ViewDidLoad(); this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "photos"); this.dataSource.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) { cell.ImageView.Image = new UIImage(this.dataSource.Items[indexPath.Row] as NSString); TKView view = cell.BackgroundView as TKView; view.Stroke.Width = 0; cell.ImageView.Layer.ShadowColor = new UIColor(0.27f, 0.27f, 0.55f, 1.0f).CGColor; cell.ImageView.Layer.ShadowOffset = new CGSize(2, 2); cell.ImageView.Layer.ShadowOpacity = 0.5f; cell.ImageView.Layer.ShadowRadius = 3; }); this.listView.Frame = this.View.Bounds; this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.listView.WeakDataSource = this.dataSource; this.listView.CellAppearBehavior = new TKListViewCellScaleInBehavior(); this.View.AddSubview(this.listView); TKListViewColumnsLayout layout = (TKListViewColumnsLayout)this.listView.Layout; layout.ItemSize = new CGSize(130, 180); layout.MinimumLineSpacing = 10; layout.CellAlignment = TKListViewCellAlignment.Stretch; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.Photos = new TKDataSource("PhotosWithNames", "json", "photos"); this.Names = new TKDataSource("PhotosWithNames", "json", "names"); TKListView listView = new TKListView(this.View.Bounds); listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; listView.DataSource = new ListViewDataSource(this); this.View.AddSubview(listView); listView.RegisterClassForCell(new Class(typeof(ImageWithTextListViewCell)), "cell"); TKListViewColumnsLayout layout = (TKListViewColumnsLayout)listView.Layout; layout.CellAlignment = TKListViewCellAlignment.Center; layout.ColumnsCount = 2; layout.ItemSize = new CGSize(150, 200); layout.MinimumLineSpacing = 60; layout.MinimumInteritemSpacing = 10; listView.Fill = TKLinearGradientFill.WithColors(new UIColor[] { new UIColor(0.35f, 0.68f, 0.89f, 0.89f), new UIColor(0.35f, 0.68f, 1.0f, 1.0f), new UIColor(0.85f, 0.8f, 0.2f, 0.8f) }); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "players"); this.label.Frame = new CGRect(0, this.View.Bounds.Height - 44, this.View.Bounds.Size.Width, 44); this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; this.label.TextAlignment = UITextAlignment.Center; this.View.AddSubview(this.label); this.listView.Frame = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 55); this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.listView.Delegate = new ListViewDelegate(this); this.listView.WeakDataSource = this.dataSource; this.listView.SelectionBehavior = TKListViewSelectionBehavior.Press; this.listView.AllowsMultipleSelection = true; this.View.AddSubview(this.listView); TKListViewColumnsLayout layout = new TKListViewColumnsLayout(); layout.CellAlignment = TKListViewCellAlignment.Stretch; layout.MinimumLineSpacing = 0; NSIndexPath indexPath = NSIndexPath.FromRowSection(1, 0); this.listView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None); }
void ColumnLayoutSelected(object sender, EventArgs e) { this.ListView.Insets = UIEdgeInsets.Zero; TKListViewColumnsLayout layout = new TKListViewColumnsLayout(); layout.MinimumLineSpacing = 0; layout.MinimumInteritemSpacing = 0; layout.ItemSize = new CGSize(100f, 100f); layout.ColumnsCount = 2; this.ListView.Layout = layout; this.ListView.ReloadData(); this.ListView.ScrollDirection = TKListViewScrollDirection.Vertical; this.SetSelectedOptionInSection(1, 1); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "teams"); this.dataSource.GroupItemSourceKey = "items"; this.dataSource.GroupWithKey("key"); TKListView listView = new TKListView(this.View.Bounds); listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; listView.WeakDataSource = dataSource; listView.SelectionBehavior = TKListViewSelectionBehavior.Press; this.View.AddSubview(listView); TKListViewColumnsLayout layout = (TKListViewColumnsLayout)listView.Layout; layout.CellAlignment = TKListViewCellAlignment.Stretch; layout.ItemSize = new CGSize(300, 44); layout.MinimumLineSpacing = 0; layout.HeaderReferenceSize = new CGSize(100, 44); layout.FooterReferenceSize = new CGSize(100, 44); this.dataSource.Settings.ListView.InitCell(delegate(TKListView list, NSIndexPath indexPath, TKListViewCell cell, NSObject item) { TKDataSourceGroup group = this.dataSource.Items[indexPath.Section] as TKDataSourceGroup; cell.TextLabel.Text = group.Items[indexPath.Row] as NSString; }); this.dataSource.Settings.ListView.InitHeader(delegate(TKListView list, NSIndexPath indexPath, TKListViewHeaderCell headerCell, TKDataSourceGroup group) { headerCell.TextLabel.Text = String.Format("{0}", group.Key); headerCell.TextLabel.TextAlignment = UITextAlignment.Center; }); this.dataSource.Settings.ListView.InitFooter(delegate(TKListView list, NSIndexPath indexPath, TKListViewFooterCell footerCell, TKDataSourceGroup group) { footerCell.TextLabel.Text = String.Format("Members count: {0}", group.Items.Length); footerCell.TextLabel.TextAlignment = UITextAlignment.Left; footerCell.TextLabel.Frame = new CGRect(5, 10, 200, 22); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.photos.LoadDataFromJSONResource("PhotosWithNames", "json", "photos"); this.names.LoadDataFromJSONResource("PhotosWithNames", "json", "names"); TKListView listView = new TKListView(this.View.Bounds); listView.BackgroundColor = new UIColor(0.0f, 1.0f, 0.0f, 0.5f); listView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; listView.Delegate = new ListViewDelegate(this); listView.DataSource = new ListViewDataSource(this); listView.CellBufferSize = 5; listView.Insets = new UIEdgeInsets(10, 10, 10, 10); this.View.AddSubview(listView); listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(CustomCardListViewCell)), "cell"); TKListViewColumnsLayout layout = (TKListViewColumnsLayout)listView.Layout; layout.ItemSize = new CGSize(100, 120); layout.MinimumLineSpacing = 5; layout.CellAlignment = TKListViewCellAlignment.Stretch; }