RadioButton - CheckBox 컨트롤과 마찬가지로 ToggleButton을 상속받아 구현된 컨트롤 - 선택/미선택 같은 UI에 사용 가능 - Checked 상태가 그룹 내에서 오직 한개의 RadioButton에만 적용 되도록 할 수 있습니다. - GroupName 프로퍼티 설정하여 그룹핑을 할 수 있으며, IsChecked 프로퍼티 참조하여 RadioButton적용 |
RadioButton.Xaml <UserControl x:Class="RiaRadioButton.MainPage" 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" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <StackPanel Orientation="Vertical"> <TextBlock Text="Do you Like Subject??"></TextBlock> <StackPanel Orientation="Horizontal"> <RadioButton Width="80" Content="Silverlight" <RadioButton Width="80" Content="ASP.NET" <RadioButton Width="80" Content="WPF" </StackPanel> <TextBlock x:Name="txtBlkSelFruit" Text="Subject"></TextBlock> <TextBlock Text="Sbject Method??"></TextBlock> <StackPanel Orientation="Horizontal"> <RadioButton Width="80" Content="C#" <RadioButton Width="80" Content="VB" <RadioButton Width="80" Content="API" </StackPanel> <TextBlock x:Name="txtBlkSelCar" Text="MFC"></TextBlock> </StackPanel> </UserControl> |
RadioButton.Cs using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace RiaRadioButton { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } /// <summary> /// Handle Fruit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RadioButton_Checked(object sender, RoutedEventArgs e) { RadioButton rb = sender as RadioButton; if (txtBlkSelFruit != null) { //Fruit Group txtBlkSelFruit.Text = rb.Content as string; } } /// <summary> /// HandelCar /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RadioButton_Checked_1(object sender, RoutedEventArgs e) { RadioButton rb = sender as RadioButton; if (txtBlkSelCar != null) { //CarGroup txtBlkSelCar.Text = rb.Content as string; } } |
'.Net Project > SilverLight 3.0' 카테고리의 다른 글
41장) ToolTip 컨트롤 (0) | 2009.12.01 |
---|---|
40장) 다시 보는 Canvas 예제 (복습) (0) | 2009.12.01 |
38장) CheckBox 컨트롤(IsThreeStater, IsThreeState) (0) | 2009.11.27 |
37장) HyperLink Button 컨트롤(_blank, _parent, Window Name) (0) | 2009.11.27 |
36장) Repeat Button 컨트롤(Delay, Interval) (0) | 2009.11.27 |