【发布时间】:2022-01-09 03:14:36
【问题描述】:
我尝试使用 Xamarin.Community.Toolkit 在 Xamarin 表单中创建一个弹出窗口。但是没想到Popup太长了,像这样垂直全屏。 [我的截图][1] 我该如何解决。 我的 UI 代码如下。
<xct:Popup
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="Barcode_Mobile.Views.ConnectionPage" >
<Grid Padding="20,10,20,10" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Label Text="Server And Database Informations"
FontSize="18"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Start" Grid.Row="0"/>
<Entry Placeholder="Example: 127.0.0.1" Grid.Row="1" x:Name="TxtServerAddress"/>
<Entry Placeholder="Username" Grid.Row="2" x:Name="TxtLogIn"/>
<Entry Placeholder="Password" Grid.Row="3" x:Name="TxtPasswd" IsPassword="True"/>
<Picker Grid.Row=" 4" x:Name="DbPicker" ItemsSource="{Binding}" Visual="Material"/>
<Button Text="Connect" Grid.Row="5" x:Name="BtnConnect" Clicked="BtnConnect_Clicked" WidthRequest="300"/>
</Grid>
</xct:Popup>```
[1]: https://i.stack.imgur.com/Dmdca.jpg
【问题讨论】:
-
弹出窗口具有vertical and horizontal 布局属性。尝试将 VerticalOptions 设置为 Start 或 Center
-
我试过这样。但还是不行。