Advertisement
Guest User

Untitled

a guest
May 15th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <Page.Resources>
  2. <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
  3. <x:String x:Key="AppName">Questionnaire</x:String>
  4. <DataTemplate x:Key="_itemTemplate">
  5. <Border BorderBrush="Gainsboro" BorderThickness="4">
  6. <StackPanel Orientation="Horizontal">
  7. <TextBlock Margin="8,0,8,0" FontSize="18" Width="200" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding crit}"/>
  8. <StackPanel>
  9. <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"/>
  10. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  11. <TextBlock VerticalAlignment="Center" Text="Rating: " FontSize="24"/>
  12. <TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding Value, ElementName=_score}" FontSize="24"/>
  13. </StackPanel>
  14. </StackPanel>
  15. </StackPanel>
  16. </Border>
  17. </DataTemplate>
  18. </Page.Resources>
  19.  
  20.  
  21. ....
  22. in the main grid:
  23.  
  24. <Border Grid.Row="1" BorderBrush="Red" BorderThickness="5">
  25. <TextBlock Text="how often have you..." TextWrapping="Wrap" FontWeight="Bold" FontSize="20" VerticalAlignment="Center"/>
  26. </Border>
  27. <ListView x:Name="_listView" Grid.Row="2" ItemTemplate="{StaticResource _itemTemplate}" SelectionMode="None" HorizontalContentAlignment="Stretch"/>
  28. <TextBlock Grid.Row="2" Grid.Column="1" x:Name="_result" FontSize="70"/>
  29.  
  30. ...
  31.  
  32. in codebehind file
  33.  
  34.  
  35.  
  36. //list to populate the TextBlock in DataTemplate
  37.  
  38. _listView.ItemsSource = new ObservableCollection<Category>
  39. {
  40. new Category{crit = "1231231231231231231?"},
  41. new Category{crit = "asdfafhadgfjargfjagj?"},
  42. new Category{crit = "qerklhjyahkildfjkladnhjkla?"},
  43. new Category{crit = "13490p76812390-qhjsedhjklg?"},
  44. new Category{crit = "asdfasdgq3e45uq345u?"},
  45. new Category{crit = "q3490u8yq38945yasdjiofhj?"},
  46. new Category{crit = "13406923789045whjioerghjkla?"}
  47. };
  48.  
  49.  
  50.  
  51. class Category
  52. {
  53. public string crit { get; set; }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement