例如我有这样的xaml代码:
<Window x:Class="SwitchingControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal">
<RadioButton Content="First"></RadioButton>
<RadioButton Content="Second"></RadioButton>
<RadioButton Content="Third"></RadioButton>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Label Content="First" Grid.Row="0" ></Label>
<Label Content="Second" Grid.Row="1"></Label>
<Label Content="First" Grid.Row="2"></Label>
<Label Content="Second" Grid.Row="3"></Label>
<Label Content="Third" Grid.Row="4"></Label>
<Label Content="Third" Grid.Row="5"></Label>
<Label Content="Second" Grid.Row="6"></Label>
</Grid>
</Grid>
</Grid>
</Window>
我需要检查内容为First
First
RadioButton
的标签。如果Second
被检查,则内容为Second RadioButton
的标签。
标签数量为70-100的主要问题。是否有一些优雅的简单方法来实现它?