Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
Enable grid to fit to screen and enable scrolling
posted

I currently have a grid that sets the ' configGrid.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; ' property to make sure that the grid fills the whoel width of its parent view.

When I populate hte grid with 100 rows and 4 columns this works as expected; it fills the width of the view and I can scroll vertically through the list.

However, if I populate the grid with 100 rows and 30 columns, I cannot get it to scroll horizontally through the additional columns.

What property/method am I missing?

Cheers,

Paul

  • 695
    posted

    Ok, using the code below, the grid all works except for the horizontal scrolling. All the columns have been effectively' best fitted' to the grid. I know I must be causing that and it something obvious, but I just cannot see it! help!

    public override void ViewDidLoad ()
            {
                base.ViewDidLoad ();
            


                // Create a new gridview
                IGGridView configGrid = new IGGridView( new RectangleF(0,0,(this.View.Bounds.Width),this.View.Bounds.Height),IGGridViewStyle.IGGridViewStyleDefault);

                // Enable flexible width so that the grid feels its parents view
                configGrid.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

                // Enable 2way Scrolling
                //Grid.common.gridconfig.enableScrolling (true, true, configGrid);

                // Configure grid theme
                configGrid = configuretheme.themegrid(configGrid);

                // Add gridview to the current view
                this.View.Add(configGrid);

                // Sort out custom column headers
                if (common.customcolumnheaders.Count != 0) {
                    configdsh = common.configureheadertitles (configdsh, common.customcolumnheaders);
                }

                // Add data to the grid
                configdsh.Data = common.griddatasource.ToArray();
                configGrid.DataSource = configdsh;

                // Attempting to override column width without the use of a delegate
                configGrid.ColumnWidth = IGColumnWidth.CreateNumericColumnWidth (200f, 200f);


                // Set the filter to always be displayed and configure the default settings
                configGrid.FilterAction = IGGridViewFilterAction.IGGridViewFilterActionImmediate;
                configdsh.FilterType = IGGridViewFilterConditionType.IGGridViewFilterConditionTypeStringContains;

                string defaultValue = common.customcolumnheaders.Values.ElementAt(0);
                configdsh.FilteringKey = defaultValue;

                // The following code is used to enable the filtering popup from the navbar button
                // Configure the popover control for the filter button.
                gridfilterpopup content = new gridfilterpopup();
                content.callinggriddsh = configdsh;
                content.callinggridcontroller = configGrid;
                content.callingcustomcolumnheaders = common.customcolumnheaders;
                filterpopover = new UIPopoverController (content);
                filterpopover.PopoverContentSize = new SizeF(320,320);

                // Configure the navigation controller for this view

                // Configure a filter button
                    UIBarButtonItem filterbtn = new UIBarButtonItem (UIBarButtonSystemItem.Action);
                        filterbtn.Clicked += delegate {
                            // If the popover is already showing from the bar button item, dismiss it. Otherwise, present it.
                                if (!filterpopover.PopoverVisible)
                                    filterpopover.PresentFromBarButtonItem (filterbtn, UIPopoverArrowDirection.Any, true);
                                else
                                    filterpopover.Dismiss (true);
                                };
                
                this.NavigationItem.SetRightBarButtonItem (filterbtn, true);
                configGrid.ReloadInputViews ();
            }