예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //Show an edit button
            //NavigationItem.RightBarButtonItem = EditButtonItem;

            this.Title = "Sample";

            if (tableView != null)
            {
                dataSource = new DataBoundUITableViewSource<CustomCell, DataItem>(tableView);
                dataSource.RowAnimation = UITableViewRowAnimation.None;
                dataSource.RowSelect += HandleDataSourceRowSelect;
                dataSource.RowDeselect += HandleDataSourceRowDeselect;

                int count = 500;
                for (int i=0; i<count; i++)
                {
                    DataItem item = new DataItem();

                    int rand = random.Next(28, 144);
                    for (int c=1; c<rand; c++)
                    {
                        item.Text += "Test " + c.ToString() + " ";
                    }

                    item.Height = CustomCell.GetCellHeight(item);
                    dataSource.List.Add(item);
                }

                tableView.Source = dataSource;
            }
        }
예제 #2
0
파일: CustomCell.cs 프로젝트: runegri/MuPP
 public static float GetCellHeight(DataItem item)
 {
     SizeF size = GetStringSize(item.Text, font, new SizeF(320.0f, 1000.0f), UILineBreakMode.WordWrap);
     return size.Height;
 }
예제 #3
0
 void HandleDataSourceRowSelect(object sender, DataItem item)
 {
     Console.WriteLine(item.Height);
 }