void SelectOrAdd(int row)
        {
            UITableViewScrollPosition scroll = UITableViewScrollPosition.None;
            NSIndexPath path;

            // Calculate the row to select
            if (row >= Root[0].Count)
            {
                // Looks like the last element was selected and no longer exists...
                if (Root[0].Count > 0)
                {
                    // Get the path of the current last element
                    path   = NSIndexPath.FromRowSection(Root[0].Count - 1, 0);
                    scroll = UITableViewScrollPosition.Bottom;
                }
                else
                {
                    // No elements exist, can't select anything
                    path = null;
                }
            }
            else
            {
                path = NSIndexPath.FromRowSection(row, 0);
            }

            if (path != null)
            {
                // Select the most appropriate element
                SelectRow(path, true, scroll);
                return;
            }

            OnAddClicked(null, EventArgs.Empty);
        }
        void SelectRow(NSIndexPath path, bool animated, UITableViewScrollPosition scroll)
        {
            tableView.SelectRow(path, animated, scroll);

            // Note: Calling SelectRow() programatically will not cause the
            // TableSource's RowSelected method to be called, so we have to
            // do it ourselves.
            tableView.Source.RowSelected(tableView, path);
        }
        private void Element_ScrollToRequested(object sender, VerticalCalendarScrollToRequestedEventArgs e)
        {
            int section, row;

            if (this.Element.IsGroupingEnabled)
            {
                section = this.Element.ItemsSource.IndexOf(e.Group);
                row     = (this.Element.ItemsSource.ElementAt(section) as IEnumerable <object>).IndexOf(e.Item);
            }
            else
            {
                section = 0;
                row     = this.Element.ItemsSource.IndexOf(e.Item);
            }

            UITableViewScrollPosition position = 0;

            switch (e.Position)
            {
            case ScrollToPosition.Center:
                position = UITableViewScrollPosition.Middle;
                break;

            case ScrollToPosition.End:
                position = UITableViewScrollPosition.Bottom;
                break;

            case ScrollToPosition.MakeVisible:
                position = UITableViewScrollPosition.None;
                break;

            case ScrollToPosition.Start:
                position = UITableViewScrollPosition.Top;
                break;
            }

            this.scrollTo = () => this.Control.ScrollToRow(NSIndexPath.FromRowSection(row, section), position, e.Animated);
        }
        void SelectRow(NSIndexPath path, bool animated, UITableViewScrollPosition scroll)
        {
            tableView.SelectRow (path, animated, scroll);

            // Note: Calling SelectRow() programatically will not cause the
            // TableSource's RowSelected method to be called, so we have to
            // do it ourselves.
            tableView.Source.RowSelected (tableView, path);
        }
Esempio n. 5
0
 public void ToggleExpanded(NSIndexPath indexPath, bool animated, UITableViewScrollPosition position)
 {
     ScrollToRow (indexPath, position, animated);
     ExpandCollapse (indexPath);
 }
Esempio n. 6
0
 public virtual void SelectRowAtIndexPath([Optional] NSIndexPath indexPath, bool animated, UITableViewScrollPosition scrollPosition)
 {
 }
Esempio n. 7
0
 public virtual void ScrollToNearestSelectedRowAtScrollPosition(UITableViewScrollPosition scrollPosition, bool animated)
 {
 }
Esempio n. 8
0
 public virtual void ScrollToRowAtIndexPath(NSIndexPath indexPath, UITableViewScrollPosition atScrollPosition, bool animated)
 {
 }