We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Datagrid force reload on Xamarin.iOS

Hi,

We have an SFDataGrid and we are changing the column sizer on orientation changes. On landscape, the grid to expand to fill out the space so we are using star column sizer but in portrait we want to maintain certain widths to our columns. So we are changing the column sizer on the fly however, we can't find a way to refresh or reload the grid because there are no changes in the data. How can we achieve this? 

1 Reply

VP Vimal Prabhu Manohkaran Syncfusion Team March 31, 2017 10:03 AM UTC

Hi Mohan,

Thanks for using Syncfusion products. Your requirement can be achieved , by checking the orientation of the device and setting the suitable ColumnSizer in the ViewLayoutSubViews( ) override of the ViewController which will be fired for the orientation changes in Xamarin.iOS. Please refer the below code snippet.
 
public override void ViewDidLayoutSubviews() 
{ 
    base.ViewDidLayoutSubviews(); 
    if (UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.LandscapeLeft || UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.LandscapeRight) 
        this.sfGrid.ColumnSizer = ColumnSizer.Star; 
    else 
        this.sfGrid.ColumnSizer = ColumnSizer.None; 
    this.sfGrid.Frame = new CGRect(0, 20, View.Frame.Width, View.Frame.Height); 
} 

We have prepared a sample based on your requirements where we have set column sizer as none for portrait mode and star for landscape mode. Please find the sample from the below link.

Sample Link : https://www.syncfusion.com/downloads/support/forum/129720/ze/GettingStarted658956030

Regards,
Vimal Prabhu
 


Loader.
Live Chat Icon For mobile
Up arrow icon