Guest User

Untitled

a guest
Jan 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. public class MyFolder
  2. {
  3. public string Path { get; set; }
  4. public int Id { get; set; }
  5. public List<MyFile> FilesList { get; set; }
  6. }
  7.  
  8. public class MyFile
  9. {
  10. public string Path { get; set; }
  11. public int Size { get; set; }
  12. }
  13.  
  14. public ObservableCollection<MyFolder> FoldersList { get; set; }
  15.  
  16. public MyFolder SelectedFolder
  17. {
  18. get { return selectedFolder; }
  19. set
  20. {
  21. selectedFolder = value;
  22. OnPropertyChanged(nameof(SelectedFolder));
  23. }
  24. }
  25.  
  26. <ListBox ItemsSource="{Binding Path=FoldersList.FilesList}" SelectedItem="{Binding Path=SelectedFolder, Mode=OneWayToSource}">
  27. <ListBox.ItemTemplate>
  28. <DataTemplate>
  29. <StackPanel>
  30. <CheckBox IsChecked="{Binding ????}"/>
  31. <Label VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding Path=Path}">
  32. </StackPanel>
  33. </DataTemplate>
  34. </ListBox.ItemTemplate>
  35. </ListBox>
  36.  
  37. <ListBox ItemsSource="{Binding Path=FoldersList.FilesList}" SelectedItem="{Binding Path=SelectedFolder, Mode=OneWayToSource}">
  38. <ListBox.ItemTemplate>
  39. <DataTemplate>
  40. <StackPanel>
  41. <CheckBox IsChecked="{Binding Checked}"/>
  42. <Label VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding Path=Path}">
  43. </StackPanel>
  44. </DataTemplate>
  45. </ListBox.ItemTemplate>
  46. </ListBox>
  47.  
  48.  
  49.  
  50. public class MyFile : INotifyPropertyChanged
  51. {
  52. public void SetPropertyChanged(string propertyName)
  53. {
  54. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  55. }
  56. public event PropertyChangedEventHandler PropertyChanged;
  57. public string Path { get; set; }
  58. public int Size { get; set; }
  59. private bool _checked = false;
  60. public bool Checked
  61. {
  62. get {return _checked;}
  63. set
  64. {
  65. _checked = value;
  66. SetPropertyChanged("Checked");
  67. }
  68. }
Add Comment
Please, Sign In to add comment