﻿<UserControl
    x:Class="FeedbackApp.SIUFViews.SIUF_RatingsQuestionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FeedbackApp.SIUFViews"
    xmlns:conv="using:FeedbackApp.Converters"
    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="500">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="SIUFStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Default">
                    <Style x:Key="AnchorText" TargetType="TextBlock">
                        <Setter Property="TextWrapping" Value="Wrap"/>
                        <Setter Property="Opacity" Value="0.6"/>
                    </Style>
                </ResourceDictionary>
                <ResourceDictionary x:Key="HighContrast">
                    <Style x:Key="AnchorText" TargetType="TextBlock">
                        <Setter Property="TextWrapping" Value="Wrap"/>
                        <Setter Property="Opacity" Value="1"/>
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.ThemeDictionaries>

            <Style x:Key="RatingRadioButton" TargetType="RadioButton">
                <Setter Property="Margin" Value="10,0,0,0"/>
                <Setter Property="Foreground" Value="{ThemeResource BlackTextColor}"/>
            </Style>

            <conv:EnumToBooleanConverter x:Key="EnumToBooleanConverter"/>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!--Question Text-->
        <TextBlock Grid.Row="0"
                   Text="{Binding Path=QuestionText}"
                   Style="{StaticResource QuestionText}"/>

        <!--Main Content-->
        <StackPanel Grid.Row="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <RadioButton x:Name="RadioButton1" Grid.Row="0" Grid.Column="0" x:Uid="/FeedbackApp.Resources/SIUF_Rating1" Content="1" IsChecked="{Binding Path=InputRating, Mode=TwoWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Microsoft.Windows.Internal.Feedback.Rating.Value1}" AutomationProperties.LabeledBy="{Binding ElementName=AnchorTextMin}" Style="{StaticResource RatingRadioButton}"/>
                <RadioButton Grid.Row="0" Grid.Column="2" x:Uid="/FeedbackApp.Resources/SIUF_Rating2" Content="2" IsChecked="{Binding Path=InputRating, Mode=TwoWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Microsoft.Windows.Internal.Feedback.Rating.Value2}" Style="{StaticResource RatingRadioButton}"/>
                <RadioButton Grid.Row="0" Grid.Column="4" x:Uid="/FeedbackApp.Resources/SIUF_Rating3" Content="3" IsChecked="{Binding Path=InputRating, Mode=TwoWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Microsoft.Windows.Internal.Feedback.Rating.Value3}" Style="{StaticResource RatingRadioButton}"/>
                <RadioButton Grid.Row="0" Grid.Column="6" x:Uid="/FeedbackApp.Resources/SIUF_Rating4" Content="4" IsChecked="{Binding Path=InputRating, Mode=TwoWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Microsoft.Windows.Internal.Feedback.Rating.Value4}" Style="{StaticResource RatingRadioButton}"/>
                <RadioButton Grid.Row="0" Grid.Column="8" x:Uid="/FeedbackApp.Resources/SIUF_Rating5" Content="5" IsChecked="{Binding Path=InputRating, Mode=TwoWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Microsoft.Windows.Internal.Feedback.Rating.Value5}" AutomationProperties.LabeledBy="{Binding ElementName=AnchorTextMax}" Style="{StaticResource RatingRadioButton}">
                </RadioButton>

            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="5*" />
                    <ColumnDefinition Width="2*" />
                </Grid.ColumnDefinitions>

                <TextBlock x:Name="AnchorTextMin" x:Uid="/FeedbackApp.Resources/SIUF_Rating_Anchor_Text_Min" AutomationProperties.AccessibilityView="Raw" AutomationProperties.Name="{Binding AutomationNameRating1}" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Text="{Binding AnchorTextMin}" Style="{ThemeResource AnchorText}"/>
                <TextBlock x:Name="AnchorTextMax" x:Uid="/FeedbackApp.Resources/SIUF_Rating_Anchor_Text_Max" AutomationProperties.AccessibilityView="Raw" AutomationProperties.Name="{Binding AutomationNameRating5}" HorizontalAlignment="Right" Grid.Column="3" Grid.Row="0" Text="{Binding AnchorTextMax}" Style="{ThemeResource AnchorText}"/>
            </Grid>
        </StackPanel>

        <!--FollowUp Header-->
        <TextBlock Grid.Row="3" x:Name="FollowUpQuestion"
                   Text="{Binding Path=FollowUpQuestionText}" 
                   Style="{StaticResource FollowUpQuestion}"/>

        <!--FollowUp Content-->
        <StackPanel Grid.Row="4">
            <TextBox x:Name="FollowUpTextBox" 
                     x:Uid="/FeedbackApp.Resources/SIUF_FollowupQuestion_TextBox" 
                     Text="{Binding Path=FollowUpText, Mode=TwoWay}" 
                     Style="{StaticResource FollowUpQuestionTextBox}"
                     AutomationProperties.Name="{Binding Path=FollowUpQuestionText}"/>
        </StackPanel>
    </Grid>
</UserControl>

