Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.68 KB | None | 0 0
  1. //Datacontext for local database
  2. private WordDataContext wordsDB;
  3.  
  4. //Observable collection for binding
  5. private ObservableCollection<WordItem> _wordItems = new ObservableCollection<WordItem>();
  6. public ObservableCollection<WordItem> WordItems
  7. {
  8. get
  9. {
  10. return _wordItems;
  11. }
  12. set
  13. {
  14. if (_wordItems != value)
  15. {
  16. _wordItems = value;
  17. NotifyPropertyChanged("WordItems");
  18. }
  19. }
  20. }
  21.  
  22. protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
  23. {
  24. // Define the query to gather all of the idea items.
  25. var wordItemsInDB = from WordItem word in wordsDB.WordItems
  26. select word;
  27.  
  28. // Execute the query and place the results into a collection.
  29. WordItems = new ObservableCollection<WordItem>(wordItemsInDB);
  30.  
  31. // Call the base method.
  32. base.OnNavigatedTo(e);
  33. }
  34.  
  35. private void newIdeaAddButton_Click(object sender, RoutedEventArgs e)
  36. {
  37. //// Create a new idea item based on the text box.
  38. //WordItem newIdea = new WordItem { WordName = "TestTest" };
  39. //Debug.WriteLine("I'm here!");
  40. //// Add a idea item to the observable collection.
  41. //WordItems.Add(newIdea);
  42.  
  43. //// Add a idea item to the local database.
  44. //wordsDB.WordItems.InsertOnSubmit(newIdea);
  45. WordItem newword = new WordItem { WordName = "Bingo" };
  46. if (WordItems == null)
  47. {
  48. Debug.WriteLine("I'm null!");
  49. WordItems = new ObservableCollection<WordItem>();
  50. }
  51.  
  52. WordItems.Add(newword);
  53. wordsDB.WordItems.InsertOnSubmit(newword);
  54. Debug.WriteLine("Did something!");
  55. }
  56.  
  57. <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
  58. <!--<ListBox Margin="14,0,-12,0" FontSize="{StaticResource PhoneFontSizeExtraLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}">
  59. <ListBoxItem Content="About" Tap="GoToAbout"/>
  60. </ListBox>-->
  61. <telerikData:RadJumpList x:Name="TestList" IsStickyHeaderEnabled="True" Margin="14,0,-12,0" ItemsSource="{Binding WordItems}">
  62. <telerikData:RadJumpList.ItemTemplate>
  63. <DataTemplate>
  64. <StackPanel Orientation="Horizontal" Height="74">
  65. <Rectangle x:Name="Bully" Width="20" Fill="Gray" Height="62" VerticalAlignment="Top" HorizontalAlignment="Left" />
  66. <TextBlock Style="{StaticResource PhoneTextExtraLargeStyle}" Text="{Binding WordItem}" VerticalAlignment="Top"/>
  67. </StackPanel>
  68. </DataTemplate>
  69. </telerikData:RadJumpList.ItemTemplate>
  70.  
  71. <telerikData:RadJumpList.StickyHeaderTemplate>
  72. <DataTemplate>
  73. <Border HorizontalAlignment="Stretch" Background="{StaticResource PhoneBackgroundBrush}" Height="74">
  74. <Border Background="{StaticResource PhoneAccentBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Width="62" Height="62">
  75. <TextBlock Text="{Binding}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Padding="7,0,0,0" VerticalAlignment="Bottom" Foreground="White" />
  76. </Border>
  77. </Border>
  78. </DataTemplate>
  79. </telerikData:RadJumpList.StickyHeaderTemplate>
  80.  
  81. <telerikData:RadJumpList.GroupHeaderTemplate>
  82. <DataTemplate>
  83. <Border HorizontalAlignment="Stretch" Background="{StaticResource PhoneBackgroundBrush}" Height="74">
  84. <Border Background="{StaticResource PhoneAccentBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Width="62" Height="62">
  85. <TextBlock Text="{Binding}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Padding="7,0,0,0" VerticalAlignment="Bottom" Foreground="White" />
  86. </Border>
  87. </Border>
  88. </DataTemplate>
  89. </telerikData:RadJumpList.GroupHeaderTemplate>
  90.  
  91. <telerikData:RadJumpList.GroupPickerItemsPanel>
  92. <ItemsPanelTemplate>
  93. <toolkit:WrapPanel HorizontalAlignment="Center" ItemHeight="111" ItemWidth="111"/>
  94. </ItemsPanelTemplate>
  95. </telerikData:RadJumpList.GroupPickerItemsPanel>
  96.  
  97. <telerikData:RadJumpList.GroupPickerItemTemplate>
  98. <DataTemplate>
  99. <Border Background="{StaticResource PhoneAccentBrush}" Width="99" Height="99" VerticalAlignment="Top" HorizontalAlignment="Left">
  100. <TextBlock Text="{Binding}" Style="{StaticResource PhoneTextExtraLargeStyle}" VerticalAlignment="Bottom" Foreground="White" />
  101. </Border>
  102. </DataTemplate>
  103. </telerikData:RadJumpList.GroupPickerItemTemplate>
  104. </telerikData:RadJumpList>
  105. <Button x:Name="newIdeaAddButton" Click="newIdeaAddButton_Click" Content="Button" Height="72" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="160" />
  106. </Grid>
  107.  
  108. GenericGroupDescriptor<string, string> testgroup = new GenericGroupDescriptor<string, string>(listitem => listitem.Substring(0, 1).ToLower());
  109.  
  110. GenericGroupDescriptor<WordItem, string> gengd = new GenericGroupDescriptor<WordItem, string>();
  111. gengd.KeySelector = (WordItem item) =>
  112. {
  113. char keyhead = item.WordName[0];
  114. return keyhead.ToString().ToLower();
  115. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement