日期:2014-05-16 浏览次数:20894 次
<UserControl x:Class="WPF2.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Height="80" Width="220" Background="Yellow">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<CheckBox Content="CheckBox" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<CheckBox Content="CheckBox" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<CheckBox Content="CheckBox" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<CheckBox Content="CheckBox" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</UserControl>
public class Myclass
{
static CheckBox checkBox1 = new CheckBox();
static CheckBox checkBox2 = new CheckBox();
static CheckBox checkBox3 = new CheckBox();
static CheckBox checkBox4 = new CheckBox();
public int SelectedNumber //只读属性
{
&nb