private Sub animateswipe(fromFrame As Int, toFrame As Int)
If toFrame < fromFrame Then
Dim moveright As Boolean = False
Else
Dim moveright As Boolean = True
End If
Dim outframe As Panel = setpanel(toFrame)
Dim inframe As Panel = setpanel(fromFrame)
outframe.Visible = True
inframe.Visible = True
If moveright Then ' <- this is the line at which freeze occurs
inframe.SetLayout(-(100%x) ,inframe.Top,inframe.Width,inframe.Height)
outframe.SetLayoutAnimated(500,100%x,outframe.Top,outframe.Width,outframe.Height)
inframe.SetLayoutAnimated(500, 0,inframe.Top,inframe.Width,inframe.Height)
Else
inframe.SetLayout(100%x ,inframe.Top,inframe.Width,inframe.Height)
outframe.SetLayoutAnimated(500,100%x,outframe.Top,outframe.Width,outframe.Height)
inframe.SetLayoutAnimated(500, 0,inframe.Top,inframe.Width,inframe.Height)
outframe.SetVisibleAnimated(500,False)
End If
End Sub