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
40
After screenrotation horizontal scrolling is limited
posted

Hi,

I've a grid with few fixed left (3) rows and much more flexible rows (~10). I'm starting in portrait orientation. The horizontal scrolling behavior is as expected. But after changing the orientation to landscape the old scrolling boundaries are still in use. If I try to scroll with a swipe from the right border nothing happens. But if I try scrolling from the middle of the screen then it behaves like expected.

I have tried to call Grid.ReloadData() or Grid.ReloadInputView but it's still the same behavior. Only changing to another view (tab view) and back to the origin fixes the scrolling issue.

Below some lines of code...

public override void ViewDidLoad()
{
    base.ViewDidLoad();
    
    LoadAndCreateGrid();
    LoadData();
}       

public override void ViewWillAppear(bool animated)
{
    base.ViewWillAppear(animated);

    SetGridHeaderHeight();
    Grid.ReloadData();
}

public override void ViewDidAppear(bool animated)
{
    base.ViewDidAppear(animated);

    // Workaround
    Grid.Frame = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height - toolbar.Frame.Height);
    toolbar.Frame = new RectangleF(0, View.Frame.Size.Height - toolbar.Frame.Height, View.Frame.Size.Width, toolbar.Frame.Size.Height);
}

public override void WillAnimateRotation(UIInterfaceOrientation toInterfaceOrientation, double duration)
{
    base.WillAnimateRotation(toInterfaceOrientation, duration);

    //Workaround
    UIView.Animate(duration, () =>
    {
        toolbar.Frame = new RectangleF(0, View.Superview.Frame.Size.Height - toolbar.Frame.Size.Height, View.Superview.Frame.Size.Width, toolbar.Frame.Size.Height);
        Grid.Frame = new RectangleF(0, 0, View.Superview.Bounds.Width, View.Superview.Bounds.Height - toolbar.Frame.Height);
    });
}

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi!

    To be honest, i'm not sure whats going on.  To handle rotation, you shouldn't need any special code. Generally we just use the AutoResizingMask and let the grid auto size to the correct size. Is that what you're doing?

    I've attached a sample that demonstrates this, including fixed columns. 

    Maybe, it'll help you to see the problem. If its simply that my sample doesn't cover your scenario, would it be possible for you to modify it to do so?

    Either way, let me know! 

    Thanks,

    -SteveZ

    FixedScrolling_Orientation.zip
Children
No Data