Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Page.Resources>
- <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
- <x:String x:Key="AppName">Questionnaire</x:String>
- <DataTemplate x:Key="_itemTemplate">
- <Border BorderBrush="Gainsboro" BorderThickness="4">
- <StackPanel Orientation="Horizontal">
- <TextBlock Margin="8,0,8,0" FontSize="18" Width="200" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding crit}"/>
- <StackPanel>
- <Slider Margin="10,0,10,0" VerticalAlignment="Center" Value="2" Maximum="5" Minimum="0" TickFrequency="1" TickPlacement="Outside" x:Name="_score" Width="641" ValueChanged="_slidScore"/>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
- <TextBlock VerticalAlignment="Center" Text="Rating: " FontSize="24"/>
- <TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding Value, ElementName=_score}" FontSize="24"/>
- </StackPanel>
- </StackPanel>
- </StackPanel>
- </Border>
- </DataTemplate>
- </Page.Resources>
- ....
- in the main grid:
- <Border Grid.Row="1" BorderBrush="Red" BorderThickness="5">
- <TextBlock Text="how often have you..." TextWrapping="Wrap" FontWeight="Bold" FontSize="20" VerticalAlignment="Center"/>
- </Border>
- <ListView x:Name="_listView" Grid.Row="2" ItemTemplate="{StaticResource _itemTemplate}" SelectionMode="None" HorizontalContentAlignment="Stretch"/>
- <TextBlock Grid.Row="2" Grid.Column="1" x:Name="_result" FontSize="70"/>
- ...
- in codebehind file
- //list to populate the TextBlock in DataTemplate
- _listView.ItemsSource = new ObservableCollection<Category>
- {
- new Category{crit = "1231231231231231231?"},
- new Category{crit = "asdfafhadgfjargfjagj?"},
- new Category{crit = "qerklhjyahkildfjkladnhjkla?"},
- new Category{crit = "13490p76812390-qhjsedhjklg?"},
- new Category{crit = "asdfasdgq3e45uq345u?"},
- new Category{crit = "q3490u8yq38945yasdjiofhj?"},
- new Category{crit = "13406923789045whjioerghjkla?"}
- };
- class Category
- {
- public string crit { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement