<UserControl x:Class="Valg.EVA.Skanning.UserInterfaceElements.EmergencyMode.SelectElectionEventView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:emergencyMode="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements.EmergencyMode"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance d:Type=emergencyMode:SelectElectionEventViewModel}"
             >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Text="{Binding Title}" Style="{StaticResource TextBlockMediumHeader}"  Margin="0,0,0,20" />
        <ItemsControl Grid.Row="1" ItemsSource="{Binding ElectionEvents}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <RadioButton
                        Margin="0, 0,0,10"
                        GroupName="ElectionEventGroup"
                        Command="{Binding Path=DataContext.RadioButtonSelectedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type emergencyMode:SelectElectionEventView} } }"
                        CommandParameter="{Binding}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Id}" Style="{StaticResource TextBlockNormal}" />
                            <TextBlock Text="{Binding Name}" Style="{StaticResource TextBlockNormal}" Margin="5,0,0,0" />
                        </StackPanel>
                    </RadioButton>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
