Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyFolder
- {
- public string Path { get; set; }
- public int Id { get; set; }
- public List<MyFile> FilesList { get; set; }
- }
- public class MyFile
- {
- public string Path { get; set; }
- public int Size { get; set; }
- }
- public ObservableCollection<MyFolder> FoldersList { get; set; }
- public MyFolder SelectedFolder
- {
- get { return selectedFolder; }
- set
- {
- selectedFolder = value;
- OnPropertyChanged(nameof(SelectedFolder));
- }
- }
- <ListBox ItemsSource="{Binding Path=FoldersList.FilesList}" SelectedItem="{Binding Path=SelectedFolder, Mode=OneWayToSource}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel>
- <CheckBox IsChecked="{Binding ????}"/>
- <Label VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding Path=Path}">
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <ListBox ItemsSource="{Binding Path=FoldersList.FilesList}" SelectedItem="{Binding Path=SelectedFolder, Mode=OneWayToSource}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel>
- <CheckBox IsChecked="{Binding Checked}"/>
- <Label VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding Path=Path}">
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- public class MyFile : INotifyPropertyChanged
- {
- public void SetPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- public event PropertyChangedEventHandler PropertyChanged;
- public string Path { get; set; }
- public int Size { get; set; }
- private bool _checked = false;
- public bool Checked
- {
- get {return _checked;}
- set
- {
- _checked = value;
- SetPropertyChanged("Checked");
- }
- }
Add Comment
Please, Sign In to add comment