10-windowsPhone常用控件---复选框

来源:互联网 发布:求职网络打字员 编辑:程序博客网 时间:2024/06/06 03:47


代码:

<!--ContentPanel - 在此处放置其他内容-->        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">            <TextBlock Height="100" HorizontalAlignment="Left" Margin="48,40,0,0" Name="textBlock1" Text="请选择你要修的课程:" VerticalAlignment="Top" Width="303" />            <CheckBox Content="Android应用程序开发" Height="72" HorizontalAlignment="Left" Margin="69,116,0,0" Name="checkBox1" VerticalAlignment="Top" Checked="checkBox1_Checked" />            <CheckBox Content="Windows Phone 7应用开发" Height="72" HorizontalAlignment="Left" Margin="69,194,0,0" Name="checkBox2" VerticalAlignment="Top" Checked="checkBox2_Checked" />            <CheckBox Content="CSS/HTML" Height="72" HorizontalAlignment="Left" Margin="69,284,0,0" Name="checkBox3" VerticalAlignment="Top" Checked="checkBox3_Checked" />            <TextBlock Height="36" HorizontalAlignment="Left" Margin="24,383,0,0" Name="textBlock2" Text="您的选择是:" VerticalAlignment="Top" Width="149" />            <TextBlock Height="113" HorizontalAlignment="Left" Margin="71,440,0,0" Name="textBlock3" Text="" VerticalAlignment="Top" Width="316" TextWrapping="Wrap" >                <LineBreak/>            </TextBlock>        </Grid>
 private void checkBox1_Checked(object sender, RoutedEventArgs e)        {            if (checkBox1.IsChecked == true) {                textBlock3.Text +=  checkBox1.Content.ToString() + "、";            }        }        private void checkBox2_Checked(object sender, RoutedEventArgs e)        {            if (checkBox2.IsChecked == true)            {                textBlock3.Text += checkBox2.Content.ToString()+"、";            }        }        private void checkBox3_Checked(object sender, RoutedEventArgs e)        {            if (checkBox3.IsChecked == true)            {                textBlock3.Text += checkBox3.Content.ToString() + "、";            }        }



原创粉丝点击