using netDxf.Units; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace PRSDesktop.Panels.DataEntry { /// /// Interaction logic for DocumentPage.xaml /// public partial class DocumentPage : UserControl, INotifyPropertyChanged { public DocumentManipulationWindow.Page Page { get; set; } private static readonly Brush SelectedBorderBrush = new SolidColorBrush(Colors.LightBlue); private static readonly Brush SelectedBackgroundBrush = new SolidColorBrush(new Color { A = 128, R = Colors.LightBlue.R, G = Colors.LightBlue.G, B = Colors.LightBlue.B, }); private static readonly Brush TransparentBrush = new SolidColorBrush(Colors.Transparent); public Brush SelectionBorder => Selected ? SelectedBorderBrush : TransparentBrush; public Brush SelectionBackground => Selected ? SelectedBackgroundBrush : TransparentBrush; private bool selected; public bool Selected { get => selected; set { selected = value; OnPropertyChanged(nameof(SelectionBorder)); OnPropertyChanged(nameof(SelectionBackground)); OnSelected?.Invoke(this, Selected); } } public delegate void OnSelectedHandler(DocumentPage page, bool selected); public event OnSelectedHandler? OnSelected; public DocumentPage(DocumentManipulationWindow.Page page) { Page = page; InitializeComponent(); } public event PropertyChangedEventHandler? PropertyChanged; public void OnPropertyChanged([CallerMemberName] string name = "") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } private void Border_MouseDown(object sender, MouseButtonEventArgs e) { Selected = !Selected; } } }