public void NavigateToList()
{
var section = Sections[0];
var data = GetSectionData(0);
if (string.IsNullOrEmpty(Caption))
{
Caption = data.ToString();
}
var dvc = new DialogViewController(Caption, null, Controller.Theme, true) { ToolbarButtons = null, NavbarButtons = null };
if (NavigationSource == null)
NavigationSource = new ListSource(dvc, data, section.ViewTypes[CellId]);
NavigationSource.SelectionAction = SelectionAction;
NavigationSource.IsSelectable = (SelectionAction == SelectionAction.PopOnSelection || SelectionAction == SelectionAction.Selection || SelectionAction == SelectionAction.Multiselection);
NavigationSource.NavigationViewType = null;
var viewType = NavigationViewType;
if (viewType == null && SelectionAction == SelectionAction.NavigateToView)
{
var genericType = data.GetType().GetGenericArguments().FirstOrDefault();
viewType = ViewContainer.GetView(genericType);
}
if (viewType != null)
{
NavigationSource.IsNavigable = viewType == typeof(ObjectCellView<object>);
NavigationSource.NavigationViewType = viewType;
}
NavigationSource.IsNavigable = !PopOnSelection && NavigationSource.IsNavigable && SelectionAction != SelectionAction.Custom;
NavigationSource.CellFactory = CellFactory;
NavigationSource.SelectedItem = SelectedItem;
NavigationSource.SelectedItems = SelectedItems;
NavigationSource.UnselectionBehavior = UnselectionBehavior;
NavigationSource.IsMultiselect = IsMultiselect;
// NavigationSource.IsSelectable = IsSelectable;
if (data.Count > 0 && (data[0].GetType().IsPrimitive || data[0].GetType().IsEnum))
NavigationSource.IsSelectable = true;
NavigationSource.PopOnSelection = PopOnSelection;
NavigationSource.NibName = NibName;
NavigationSource.TableViewStyle = TableViewStyle;
NavigationSource.IsSearchbarHidden = IsSearchbarHidden;
NavigationSource.EnableSearch = EnableSearch;
NavigationSource.IncrementalSearch = IncrementalSearch;
NavigationSource.SearchPlaceholder = SearchPlaceholder;
NavigationSource.SearchCommand = SearchCommand;
NavigationSource.SelectedAccessoryViewType = SelectedAccessoryViewType;
NavigationSource.UnselectedAccessoryViewType = UnselectedAccessoryViewType;
NavigationSource.MemberData = new MemberData(MemberData.Source, MemberData.Member);
if (NavigationSource.NavigationViewType != null)
{
var rowHeightAttribute = NavigationSource.NavigationViewType.GetCustomAttribute<RowHeightAttribute>();
if (rowHeightAttribute != null)
{
NavigationSource.MemberData.RowHeight = rowHeightAttribute.RowHeight;
}
}
NavigationSource.Controller = dvc;
dvc.TableView.Source = NavigationSource;
Controller.NavigationController.PushViewController(dvc, true);
}