Guest User

Untitled

a guest
Oct 13th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <Button x:Name="MoveImagesBack" Click="MoveImagesBack_Click" Style="{StaticResource MoveImagesButton}" Content="<"/>
  2.  
  3. <ListBox ItemsSource="{Binding Path=GamesImages}" x:Name="LoopPhotoCarousel" Margin="0 10" Grid.Column="1"
  4. ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"
  5. BorderThickness="0"
  6. >
  7. <ListBox.ItemsPanel>
  8. <ItemsPanelTemplate>
  9. <StackPanel Orientation="Horizontal"/>
  10. </ItemsPanelTemplate>
  11. </ListBox.ItemsPanel>
  12.  
  13. <ListBox.ItemContainerStyle>
  14. <Style TargetType="ListBoxItem">
  15. <Setter Property="Width" Value="200"/>
  16. <Setter Property="Height" Value="120"/>
  17. <Setter Property="Margin" Value="10 0"/>
  18. </Style>
  19. </ListBox.ItemContainerStyle>
  20.  
  21. <ListBox.ItemTemplate>
  22. <DataTemplate>
  23. <StackPanel>
  24. <Image Source="{Binding}"/>
  25. </StackPanel>
  26. </DataTemplate>
  27. </ListBox.ItemTemplate>
  28. </ListBox>
  29.  
  30. <Button Grid.Column="2" Style="{StaticResource MoveImagesButton}" Content=">"></Button>
  31.  
  32. ObservableCollection<string> gamesImages = new ObservableCollection<string>();
  33. public ObservableCollection<string> GamesImages
  34. {
  35. get
  36. {
  37. if (gamesImages.Count <= 0)
  38. {
  39. gamesImages.Add(@"Images/Games/1.jpg");
  40. gamesImages.Add(@"Images/Games/2.jpg");
  41. gamesImages.Add(@"Images/Games/3.jpg");
  42. gamesImages.Add(@"Images/Games/4.jpg");
  43. gamesImages.Add(@"Images/Games/5.jpg");
  44. gamesImages.Add(@"Images/Games/6.jpg");
  45. }
  46. return gamesImages;
  47. }
  48. }
  49.  
  50. public partial class MainWindow : Window
  51. {
  52. public MainWindow()
  53. {
  54. InitializeComponent();
  55.  
  56. this.DataContext = new MainWindowViewModel(this);
  57.  
  58. }
  59. }
Add Comment
Please, Sign In to add comment