diff --git a/FileSystemItem.cs b/FileSystemItem.cs index e62c415..047e305 100644 --- a/FileSystemItem.cs +++ b/FileSystemItem.cs @@ -1,10 +1,33 @@ -namespace CommanderApp +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace CommanderApp { - public class FileSystemItem + public class FileSystemItem : INotifyPropertyChanged { public string Name { get; set; } public string FullName { get; set; } public bool IsDirectory { get; set; } public string Icon => IsDirectory ? "folder.png" : "file.png"; + + private bool _isSelected; + public bool IsSelected + { + get => _isSelected; + set + { + _isSelected = value; + OnPropertyChanged(); + } + } + + // Событие из INotifyPropertyChanged + public event PropertyChangedEventHandler? PropertyChanged; + + // Защищённый метод для вызова события + protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/MainPage.xaml b/MainPage.xaml index 93a7e11..517dfbf 100644 --- a/MainPage.xaml +++ b/MainPage.xaml @@ -4,43 +4,46 @@ x:Class="CommanderApp.MainPage" Title="MAUI Commander"> - - + + +