Q:

ScreenWidth wrong value or ListView WidthRequest strange behaviour

I am trying to place three quadratic frames per row in a FlowListView.

xaml:
FlowListView code:
<toolkit:FlowListView 
    FlowColumnCount="3"
    HasUnevenRows="True"
    FlowRowBackgroundColor="{Binding WidgetMainColor}"
    Margin="10,0,10,0"
    FlowItemsSource="{Binding TestContainer.WidgetsInContainer}">
    <toolkit:FlowListView.FlowColumnTemplate>
        <DataTemplate>
            <Frame
                Margin="5"
                WidthRequest="{Binding WidthAndHeightForDashboard}"
                HeightRequest="{Binding WidthAndHeightForDashboard}"
                BackgroundColor="{Binding WidgetMainColor}"
                CornerRadius="2"
                HasShadow="False"/>
        </DataTemplate>
    </toolkit:FlowListView.FlowColumnTemplate>
</toolkit:FlowListView>

Calculation of width/height for the Frame:
WidthAndHeightForDashboard:
public double WidthAndHeightForDashboard
{
    get
    {
        // -50 for Margin (6 * 5 for Frame margins, 2 * 10 for FlowListView margin)
        // rest is divided by 3 because we need 3 frames
        return (double)(App.ScreenWidth - 50) / 3; 
    }
}

I am using ScreenWidth to calculate WidthAndHeightForDashboard because I know that the page will always be in portrait mode. This means we will have more height than width on this page, so width is decisive for a quadratic frame.
ScreenWidth is calculated like this:
App.ScreenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);

Screenshot of my outcome
As you can see in the screenshot, frames are taller than wide, but they should be quadratic:

I also tried to remove all margins and remove margin from the calculation in case that I have a fault in my calculation, but this does not fix the issue.
WidthRequest and HeightRequest are using the same value but the frames are taller than they are wide, so I am pretty sure that the calculated value for WidthAndHeightForDashboard is higher than it should be... Or maybe there is less space on the screen that stated by App.ScreenWidth?

A:

I still don't know what exactly happened, but I managed to find a workaround (or the right solution to do this? I don't know):
Instead of setting WidthRequest and HeightRequest of the Frame, I now set the Padding for the Frame which I calculate like this:
return (double)(App.ScreenWidth - 30 - 3 * IconWidthAndHeight) / 6;

I'll explain the calculation with this image:

30 = Summary of the width margins in the current row (5 + 10 + 10 + 5)
3 * IconWidthAndHeight = I have 3 Widgets with 46x46 size
Divide by 6 so get the value of the padding 

Sorry, I know this doesn't exactly answer the original question because I didn't include the image in the question. But maybe this is helpful for someone out there!

