Skip to content

Instantly share code, notes, and snippets.

@ashchuk
Created October 25, 2017 08:50
Show Gist options
  • Save ashchuk/bc271be2cf1eb58d90ad78532be35f79 to your computer and use it in GitHub Desktop.
Save ashchuk/bc271be2cf1eb58d90ad78532be35f79 to your computer and use it in GitHub Desktop.
<DataTemplate x:Key="AnswerListDataTemplate">
<Border Margin="5" BorderThickness="2" BorderBrush="White" Background="Transparent"
DataContext="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content}">
<TextBlock Margin="10" FontSize="28" TextWrapping="WrapWholeWords" Text="{Binding Text}"/>
</Border>
</DataTemplate>
<DataTemplate x:Key="PivotQuestionDataTemplate">
<StackPanel Orientation="Vertical">
<TextBlock FontSize="28" Margin="20" TextWrapping="WrapWholeWords" Text="{Binding Text}"/>
<ListView Grid.Row="2" Margin="0,10" IsItemClickEnabled="True"
ItemsSource="{Binding Answers}"
ItemContainerStyle="{StaticResource ListViewItemStyle}"
ItemTemplate="{StaticResource AnswerListDataTemplate}"
>
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="ItemClick" >
<ic:InvokeCommandAction Command="{Binding ElementName=pivotControl, Path=DataContext.ItemCommand}" />
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListView>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="PivotHeaderDataTemplate">
<Border Padding="5" BorderThickness="2" BorderBrush="Gray" Background="Transparent">
<TextBlock FontSize="24" Foreground="{Binding SelectedAnswerId, Converter={StaticResource TextAvailabilityToColorConverter}}">
<Run x:Uid="QuestionsPage/QuestionNumber"/>
<Run Text="{Binding QuestionNumber}"/>
</TextBlock>
</Border>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Margin="30,50,30,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text=""/>
<Pivot Grid.Row="2"
x:Name="pivotControl"
ItemsSource="{Binding Questions}"
ItemTemplate="{StaticResource PivotQuestionDataTemplate}"
HeaderTemplate="{StaticResource PivotHeaderDataTemplate}"
>
</Pivot>
</Grid>
</Grid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment