動作環境
Windows 7 Pro (32bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2
XAML
<Window x:Class="_170426_t0930_radioButton.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_170426_t0930_radioButton"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<GroupBox Header="Group1">
<RadioButton Content="Radio1" Checked="RadioButton_Checked"/>
<RadioButton Content="TV1" Checked="RadioButton_Checked"/>
</GroupBox>
</Grid>
</Window>
タイトルのエラーとなった。
何が問題か。
<StackPanel>
で囲っていないということが問題のようだ。
以下ではエラーが出なくなった。
XAML
<Window x:Class="_170426_t0930_radioButton.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_170426_t0930_radioButton"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<GroupBox Header="Group1">
<StackPanel>
<RadioButton Content="Radio1" Checked="RadioButton_Checked"/>
<RadioButton Content="TV1" Checked="RadioButton_Checked"/>
<RadioButton Content="WashingMachine1" Checked="RadioButton_Checked"/>
<RadioButton Content="Refrigerator1" Checked="RadioButton_Checked"/>
</StackPanel>
</GroupBox>
</Grid>
</Window>