#xaml #grid #ischecked
Вопрос:
Привет, я новичок в 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>