Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

XAML Relative Layout calculations

$
0
0

Hi guys, a question re XAML forms, how can you work out dimension calculations in XAML forms for a relative layout. Imagine you want to display a box height 100, width 100 in the middle of the screen. How can you do this in XAML?

RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width, Factor=0.5}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,Property=Height, Factor=0.5}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=Constant,Constant=100}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=Constant,Contstant=100}"

The problem with this is that Xamarin will start drawing the box from the centre of the screen but I want to be able to say start from (Factor=0.5 - 50) for example.

Thanks :)


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>