嗨,我是 xaml 的新手,我尝试阅读示例,但我迷路了
现在我有两个问题
我希望标签文本在按钮和文本与按钮文本对齐之前先显示标签文本,或者有标签文本、换行符然后是按钮
我无法让两个单选按钮组进行默认检查。它只是设置了 ischecked=true 的最后一组,第一组被忽略。
所以请帮忙,我出了点问题,我不知道那是什么:(
<ContentPage.BindingContext>
<vm:AboutViewModel />
</ContentPage.BindingContext>
<ContentPage.Resources>
<ResourceDictionary>
<Color x:Key="Accent">#96d1ff</Color>
</ResourceDictionary>
</ContentPage.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout BackgroundColor="{StaticResource Accent}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill">
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
<ContentView Padding="0,40,0,40" VerticalOptions="FillAndExpand">
<Image Source="xamarin_logo.png" VerticalOptions="Center" HeightRequest="64" />
</ContentView>
</StackLayout>
<StackLayout>
<StackLayout>
<Frame BackgroundColor="White" BorderColor="Black">
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="10" x:Name="Grid1">
<!--<Button Text="t1"></Button>-->
<Label Text="Radio button group 1" HorizontalTextAlignment="Center"></Label>
<RadioButton IsChecked="True" Content="None" BackgroundColor="White" GroupName="Group1" />
<RadioButton Grid.Column="1" Content="Light" BackgroundColor="#F0FF00" GroupName="Group1" />
<RadioButton Grid.Column="2" Content="Moderate" BackgroundColor="#ffba08" GroupName="Group1" />
<RadioButton Grid.Column="3" Content="Severe" BackgroundColor="#dc2f02" GroupName="Group1" />
</Grid>
</Frame>
</StackLayout>
<StackLayout>
<Frame BackgroundColor="White" BorderColor="Black">
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="10" x:Name="Grid2" >
<Label Text="Radio button group 2" HorizontalTextAlignment="Center"></Label>
<RadioButton IsChecked="True" Content="None" BackgroundColor="White" GroupName="Group2" />
<RadioButton Grid.Column="1" Content="Light" BackgroundColor="#F0FF00" GroupName="Group2" />
<RadioButton Grid.Column="2" Content="Moderate" BackgroundColor="#ffba08" GroupName="Group2" />
<RadioButton Grid.Column="3" Content="Severe" BackgroundColor="#dc2f02" GroupName="Group2" />
</Grid>
</Frame>
</StackLayout>
</StackLayout>
</StackLayout>
</Grid>