public override void ViewDidLoad() { base.ViewDidLoad(); var toolBar = new UIToolbar(new CGRect(0, 0, 320, 44)); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done); var flexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); toolBar.SetItems(new UIBarButtonItem[] { flexibleSpace, doneButton }, true); var positionItems = new GridSortIconPosition[] { GridSortIconPosition.Left, GridSortIconPosition.Inline, GridSortIconPosition.Right }; foreach (var value in Enum.GetValues(typeof(GridSortIconPosition))) { positionOptionStrings.Add(value.ToString()); } var iconItems = new C1IconTemplate[] { C1IconTemplate.TriangleNorth, C1IconTemplate.ChevronUp, C1IconTemplate.ArrowUp }; foreach (var value in new string[] { nameof(C1IconTemplate.TriangleNorth), nameof(C1IconTemplate.ChevronUp), nameof(C1IconTemplate.ArrowUp) }) { iconOptionStrings.Add(value); } var modelPosition = new PositionMModePickerViewModel(Grid, SelectionPositionModeField, positionItems); var positionOptionPicker = new UIPickerView(); positionOptionPicker.Model = modelPosition; SelectionPositionModeField.Text = string.Empty; SelectionPositionModeField.Placeholder = NSBundle.MainBundle.GetLocalizedString("Sort Icon Position", ""); SelectionPositionModeField.InputView = positionOptionPicker; SelectionPositionModeField.InputAccessoryView = toolBar; var modelIcon = new IconModePickerViewModel(Grid, SelectionIconModeField, iconItems); var iconOptionPicker = new UIPickerView(); iconOptionPicker.Model = modelIcon; SelectionIconModeField.Text = string.Empty; SelectionIconModeField.Placeholder = NSBundle.MainBundle.GetLocalizedString("Sort Icon Template", ""); SelectionIconModeField.InputView = iconOptionPicker; SelectionIconModeField.InputAccessoryView = toolBar; doneButton.Clicked += (s, e) => { Grid.BecomeFirstResponder(); }; Grid.AllowDragging = GridAllowDragging.Both; Grid.AllowResizing = GridAllowResizing.Both; //Use together with AllowResizing and AllowDragging to avoid gesture conflicts in the edge of the screen. NavigationController.InteractivePopGestureRecognizer.Enabled = false; Grid.AutoGeneratingColumn += (s, e) => { e.Column.MinWidth = 110; e.Column.Width = GridLength.Star; }; LoadData(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CustomSortIcon); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.CustomSortIcon); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); var positionModes = FindViewById <Spinner>(Resource.Id.SortIconPosition); var iconModes = FindViewById <Spinner>(Resource.Id.SortIconTemplate); var positionItems = new GridSortIconPosition[] { GridSortIconPosition.Left, GridSortIconPosition.Inline, GridSortIconPosition.Right }; var positonAdapteritems = new List <string>(); foreach (var value in Enum.GetValues(typeof(GridSortIconPosition))) { positonAdapteritems.Add(value.ToString()); } positionModes.Adapter = new ArrayAdapter(BaseContext, global::Android.Resource.Layout.SimpleSpinnerItem, positonAdapteritems); positionModes.ItemSelected += (s, e) => { grid.SortIconPosition = positionItems[positionModes.SelectedItemPosition]; }; positionModes.SetSelection(0, false); var iconItems = new C1IconTemplate[] { C1IconTemplate.TriangleNorth, C1IconTemplate.ChevronUp, C1IconTemplate.ArrowUp }; var iconAdapterItems = new List <string>(); foreach (var value in new string[] { nameof(C1IconTemplate.TriangleNorth), nameof(C1IconTemplate.ChevronUp), nameof(C1IconTemplate.ArrowUp) }) { iconAdapterItems.Add(value); } iconModes.Adapter = new ArrayAdapter(BaseContext, global::Android.Resource.Layout.SimpleSpinnerItem, iconAdapterItems); iconModes.ItemSelected += (s, e) => { grid.SortAscendingIconTemplate = iconItems[iconModes.SelectedItemPosition]; }; iconModes.SetSelection(0, false); grid = FindViewById <FlexGrid>(Resource.Id.Grid); LoadData(); }