Using height property set to auto

Shay Wilner 1,406 Reputation points


My grid height is set to auto and i would like to set the stackpanel height to 80% grid height

Universal Windows Platform (UWP)
No comments
{count} votes

Accepted answer
  1. Shay Wilner 1,406 Reputation points

    I found a solution to use the screen size
    'stp is the stackpanel

    Dim bounds As New Rect
     Dim scaleFactor As Double
     Dim size1 As Size
     bounds = ApplicationView.GetForCurrentView().VisibleBounds
     scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel
     size1 = New Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor)
     stp.Height = size1.Height * 0.8 / scaleFactor

0 additional answers

Sort by: Most helpful