Set RadioButton to check state


   
      
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="FlowDocumentPage" Height="450" Width="500">
    <DockPanel>
        <Button Padding="20" Margin="40">
            <FlowDocumentReader>
                <FlowDocument FontSize="12" xml:space="preserve">
                    <Paragraph TextAlignment="Center" FontSize="18"><Bold>bold</Bold></Paragraph>
                    <Paragraph>Para<Italic>italic</Italic>HTML</Paragraph>
                    <Paragraph>aaa<Button>Push me</Button> 
                    <RadioButton IsChecked="True">Yes</RadioButton>
                    <RadioButton>No</RadioButton>
                    <RadioButton>Unsure</RadioButton>
                    </Paragraph>
                    <Paragraph><Bold>Lists:</Bold></Paragraph>
                    <List>
                        <ListItem><Paragraph>A</Paragraph></ListItem>
                        <ListItem><Paragraph>B</Paragraph></ListItem>
                        <ListItem><Paragraph>C<Ellipse Fill="Red" Width="20" Height="20"/></Paragraph></ListItem>
                        <ListItem><Paragraph>D<Rectangle Fill="Blue" Width="20" Height="20"></Rectangle></Paragraph></ListItem>
                    </List>
                </FlowDocument>
            </FlowDocumentReader>
        </Button>
    </DockPanel>
</Window>

   
    
    
    
    
    
     


Radio Button Groups


   
      
<Window x:Class="ClassicControls.RadioButtonGroups"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="RadioButtonGroups" Height="300" Width="300">
    <StackPanel>
      <GroupBox Margin="5">
        <StackPanel>
          <RadioButton>Group 1</RadioButton>
          <RadioButton>Group 1</RadioButton>
          <RadioButton>Group 1</RadioButton>
          <RadioButton Margin="0,10,0,0" GroupName="Group2">Group 2</RadioButton>
        </StackPanel>
      </GroupBox>
      <GroupBox Margin="5">
        <StackPanel>
          <RadioButton>Group 3</RadioButton>
          <RadioButton>Group 3</RadioButton>
          <RadioButton>Group 3</RadioButton>
          <RadioButton Margin="0,10,0,0" GroupName="Group2">Group 2</RadioButton>
        </StackPanel>
      </GroupBox>
    </StackPanel>
</Window>

   
    
    
    
    
    
     


Color animate based on Radio Button Click event


   
      
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Background="{x:Static SystemColors.WindowBrush}"
      Name="page">

    <Page.Resources>
        <Style TargetType="{x:Type RadioButton}">
            <Setter Property="Margin" Value="6" />
        </Style>
    </Page.Resources>

    <StackPanel HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Background="{DynamicResource 
                                {x:Static SystemColors.ControlBrushKey}}">

        <RadioButton Content="Red">
            <RadioButton.Triggers>
                <EventTrigger RoutedEvent="RadioButton.Checked">
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation 
                                Storyboard.TargetName="page"
                                Storyboard.TargetProperty="Background.Color"
                                To="Red" Duration="0:0:1" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </RadioButton.Triggers>
        </RadioButton>

    </StackPanel>
</Page>

   
    
    
    
    
    
     


Circled Radio Buttons


   
      
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Page.Resources>
        <ControlTemplate x:Key="newradio" 
                         TargetType="{x:Type RadioButton}">
            <Border Name="border" BorderBrush="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                    Padding="10"
                    CornerRadius="100">
                <ContentPresenter />
            </Border>

            <ControlTemplate.Triggers>
                <Trigger Property="IsChecked" Value="True">
                    <Setter TargetName="border"
                            Property="BorderThickness"
                            Value="3" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Page.Resources>

    <GroupBox Header="Options" FontSize="20pt">
        <StackPanel>
            <RadioButton Template="{StaticResource newradio}"
                         HorizontalAlignment="Center" 
                         Content="1" />
            <RadioButton Template="{StaticResource newradio}"
                         HorizontalAlignment="Center"
                         Content="2"
                         IsChecked="True" />
            <RadioButton Template="{StaticResource newradio}"
                         HorizontalAlignment="Center"
                         Content="3" />
        </StackPanel>
    </GroupBox>
</Page>

   
    
    
    
    
    
     


Use StackPanel to Hold RadioButtons


   
      
<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Use Radio Buttons" Height="300" Width="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" Margin="2">
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
        </StackPanel>
        <StackPanel Grid.Column="1" Margin="2">
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
            <RadioButton Margin="5">RadioButton</RadioButton>
        </StackPanel>
    </Grid>
</Window>

   
    
    
    
    
    
     


Checked RadioButton


   
    

<Window x:Class="SimpleStyles.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="SimpleStyles"
  Background="#F8F8F8">
  <ScrollViewer>
    <WrapPanel>
      <HeaderedItemsControl Header="RadioButton">
        <RadioButton Margin="8">Normal</RadioButton>
        <RadioButton Margin="8" IsChecked="true">Checked</RadioButton>
        <RadioButton Margin="8">Normal</RadioButton>
      </HeaderedItemsControl>
   
    </WrapPanel>
  </ScrollViewer>
</Window>

   
    
    
    
     


RadialGradientBrush Rectangle.Stroke


   
  

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      WindowTitle="StackPanel vs. DockPanel">
  <Grid Width="175" Height="150">
    <Rectangle Grid.Row="1" Grid.Column="1"  Width="100" Height="100" 
      StrokeThickness="8" Margin="4">
      <Rectangle.Fill>
        <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" 
          RadiusX="0.5" RadiusY="0.5">
          <GradientStop Color="Red" Offset="0" />
          <GradientStop Color="Green" Offset="0.45" />
          <GradientStop Color="Yellow" Offset="0.85" />
        </RadialGradientBrush>
      </Rectangle.Fill>
      <Rectangle.Stroke>
        <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" 
          RadiusX="0.5" RadiusY="0.5">
          <GradientStop Color="Black" Offset="0.95" />
          <GradientStop Color="Gray" Offset="0.95" />
        </RadialGradientBrush>
      </Rectangle.Stroke>
    </Rectangle>
  </Grid>
</Page>