Private Sub ResizePreviewPanelBasedPreviewSize
Dim pw = cam.PreviewSize.Width, ph = cam.PreviewSize.Height As Int
Dim r As Float = Max(Root.Width / pw, Root.Height / ph) 'FILL_NO_DISTORTIONS (change to Min for FIT)
Dim w As Int = pw * r
Dim h As Int = ph * r
pnlCamera.SetLayoutAnimated(0, Round(Root.Width / 2 - w / 2), Round(Root.Height / 2 - h / 2), Round(w), Round(h))
End Sub