【发布时间】:2019-07-11 19:54:44
【问题描述】:
我的 Xamarin.Forms 应用中有一个 GridLayout。但是我的应用程序我使用了 BoxView。所以在这里我想在那个boxview中减少大小。在我的应用程序中,当我单击退出用户时,它运行良好,但是当我单击新单选按钮时,它会崩溃。在我的应用程序中,但在我的代码中不是那样的。我希望网格中的每个元素如下所示:
Click me and help me Existing and help me
<ContentPage.Content>
<ScrollView>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Padding="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="20" />
<RowDefinition Height="40" />
<RowDefinition x:Name="addressBoxViewRow" />
</Grid.RowDefinitions>
<Label Text="Care of User - Address" Grid.Row="0" FontAttributes="Bold" FontSize="Default" TextColor="Black" />
<Label Text="Enter the details of the person that the connection will be in care of." TextColor="#757575" Grid.Row="1" FontSize="Small" />
<FlexLayout Grid.Row="2" AlignItems="Center" JustifyContent="Start" Direction="Row">
<Label Text="Address status" FontSize="Small" FontAttributes="Bold" VerticalTextAlignment="Center" TextColor="Black" />
<input:RadioButtonGroupView Margin="20,0,0,0" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="addressStatus" VerticalOptions="CenterAndExpand">
<input:RadioButton Text="New" TextFontSize="14" x:Name="newRadioButton" Clicked="NewRadioButton_Clicked" />
<input:RadioButton Text="Existing" IsChecked="true" TextFontSize="14" x:Name="existingRadioButton" Clicked="ExistingRadioButton_Clicked" />
</input:RadioButtonGroupView>
</FlexLayout>
<BoxView Grid.Row="3" BackgroundColor="White" CornerRadius="5">
<BoxView.Effects>
<effects:ShadowEffect />
</BoxView.Effects>
</BoxView>
<!--This appears when Existing selected-->
<Grid Grid.Row="3" Padding="20" x:Name="existingAddressForm">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="20" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="Billing address" FontAttributes="Bold" FontSize="Default" TextColor="Black" />
<Label Text="Address line 1" Grid.Row="1" TextColor="#757575" FontSize="Small" />
<Label Grid.Row="2" x:Name="lblAddressLine1" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Address line 2" Grid.Row="3" TextColor="#757575" FontSize="Small" />
<Label Grid.Row="4" x:Name="lblAddressLine2" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Address line 3" Grid.Row="5" TextColor="#757575" FontSize="Small" />
<Label Grid.Row="6" x:Name="lblAddressLine3" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Postal code" Grid.Row="7" TextColor="#757575" FontSize="Small" />
<Label Grid.Row="8" x:Name="lblPostalCode" FontAttributes="Bold" FontSize="Medium" />
</Grid>
<!--This appears when New selected-->
<Grid Grid.Row="3" Padding="20" x:Name="newAddressForm">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="20" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="Billing address" FontAttributes="Bold" FontSize="Default" TextColor="Black" />
<Label Text="Address line 1" Grid.Row="1" TextColor="#757575" FontSize="Small" />
<Entry Grid.Row="2" x:Name="addressLine1" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Address line 2" Grid.Row="3" TextColor="#757575" FontSize="Small" />
<Entry Grid.Row="4" x:Name="addressLine2" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Address line 3" Grid.Row="5" TextColor="#757575" FontSize="Small" />
<Entry Grid.Row="6" x:Name="addressLine3" FontAttributes="Bold" FontSize="Medium" />
<Label Text="Postal code" Grid.Row="7" TextColor="#757575" FontSize="Small" />
<Picker Grid.Row="8" TextColor="Black" FontSize="Small" x:Name="postalCodeSelector1" ItemDisplayBinding="{Binding PostalDescription}" WidthRequest="100">
<Picker.Effects>
<effects:DropdownEffect />
</Picker.Effects>
</Picker>
</Grid>
</Grid>
<StackLayout Grid.Row="1" Orientation="Horizontal" VerticalOptions="End">
<Button Text="Clear" Style="{x:StaticResource GrayButton}" HorizontalOptions="FillAndExpand" Clicked="ClearBtn_Clicked"/>
<Button Text="Proceed" HorizontalOptions="FillAndExpand" Clicked="Handle_Clicked" x:Name="proceedBtn" />
</StackLayout>
<!--<StackLayout Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" IsVisible="{Binding IsBusy}" BackgroundColor="White" Opacity="1" Orientation="Vertical">
<StackLayout Orientation="Vertical" HorizontalOptions="Center" VerticalOptions="CenterAndExpand">
<ActivityIndicator Color="#2B428E" IsRunning="true" />
<Label x:Name="progressname" Text="Please wait ..." TextColor="#2B428E" VerticalOptions="Center" />
</StackLayout>
</StackLayout>-->
</Grid>
</ScrollView>
</ContentPage.Content>
【问题讨论】:
-
所以你有两个App?一个基于 Xamarin.Forms 的应用程序和另一个应用程序?顺便说一下这个控件来自哪里输入:RadioButtonGroupView
-
@MouseOnMars 你能检查我的附件图片吗
-
@MouseOnMars 没有相同的用户界面。当单击一个单选按钮时,在同一 Ui 中打开一些 boxview
-
@JohnLee 能不能给个“existing”的截图?
-
@AndroDevil i.stack.imgur.com/6JP03.jpg
标签: xamarin xamarin.forms