![](/img/trans.png)
[英]When I set the direction of xamarin forms flyout page to RTL, a gap appears between the side menu and the mobile screen, how can I remove it?
[英]I want to set control (chart) fit in screen when I rotate content page in xamarin forms
我正在使用xamarin形式。 我也想使用Syncfusion Chart,在ContentPage中设置像这样的控件
<StackLayout Orientation="Vertical" x:name="Stack1">
<StackLayout Orientation="Horizontal" x:name="Stack2">
<label x:name="lbl1"></label>
<image x:name="img1"></image>
</StackLayout>
<StackLayout x:name="Stack3">
<syncfusion:chart x:name=chart1>
</syncfusion:chart>
</StackLayout>
</StackLayout>
谢谢
您不需要StackLayout,需要Grid控件:
<Grid>
<Grid.RowDefenitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefenitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<label Grid.Column="0" x:name="lbl1"></label>
<image Grid.Column="1" x:name="img1"></image>
<syncfusion:chart Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:name=chart1>
</syncfusion:chart>
</Grid>
您可以像这样处理页面的方向:
public Page()
{
InitializeComponent();
SizeChanged += PageSizeChanged;
}
void PageSizeChanged(object sender, EventArgs e)
{
bool isPortrait = this.Height >= this.Width;
if(!isPortrait)
{
//move label and image and make the chart bigger here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.