1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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
- {
- /// <summary>
- /// Interaction logic for DocumentPage.xaml
- /// </summary>
- 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;
- }
- }
- }
|