You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a grid, i am just setting the grid width and height in sizechanged event for landscape and portrait of the device. while rotation the device the widthrequest and heightrequest is not set properly for the orientation. Landscape width and height is set for Portrait. Portrait width and height is set for Landscape. Below are the sample code. your help must be appreciated. Thanks
private void Views_SizeChanged(object sender, EventArgs e)
{
var info = DeviceDisplay.MainDisplayInfo;
var width = info.Width / info.Density;
var height = info.Height / info.Density;
var control = (Grid)sender;
if (width > height)
{
control.HeightRequest = 300;
control.WidthRequest = 600;
}
else
{
control.HeightRequest = 400;
control.WidthRequest = 100;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a grid, i am just setting the grid width and height in sizechanged event for landscape and portrait of the device. while rotation the device the widthrequest and heightrequest is not set properly for the orientation. Landscape width and height is set for Portrait. Portrait width and height is set for Landscape. Below are the sample code. your help must be appreciated. Thanks
private void Views_SizeChanged(object sender, EventArgs e)
{
var info = DeviceDisplay.MainDisplayInfo;
var width = info.Width / info.Density;
var height = info.Height / info.Density;
var control = (Grid)sender;
if (width > height)
{
control.HeightRequest = 300;
control.WidthRequest = 600;
}
else
{
control.HeightRequest = 400;
control.WidthRequest = 100;
}
Beta Was this translation helpful? Give feedback.
All reactions