DrawingViewPort.xaml.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Diagnostics;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Input;
  6. namespace PixiEditor.Views.UserControls
  7. {
  8. /// <summary>
  9. /// Interaction logic for DrawingViewPort.xaml.
  10. /// </summary>
  11. public partial class DrawingViewPort : UserControl
  12. {
  13. public DrawingViewPort()
  14. {
  15. InitializeComponent();
  16. }
  17. public float ZoomPercentage
  18. {
  19. get { return (float)GetValue(ZoomPercentageProperty); }
  20. set { SetValue(ZoomPercentageProperty, value); }
  21. }
  22. // Using a DependencyProperty as the backing store for ZoomPercentage. This enables animation, styling, binding, etc...
  23. public static readonly DependencyProperty ZoomPercentageProperty =
  24. DependencyProperty.Register("ZoomPercentage", typeof(float), typeof(DrawingViewPort), new PropertyMetadata(100f));
  25. public bool RecenterZoombox
  26. {
  27. get { return (bool)GetValue(RecenterZoomboxProperty); }
  28. set { SetValue(RecenterZoomboxProperty, value); }
  29. }
  30. // Using a DependencyProperty as the backing store for RecenterZoombox. This enables animation, styling, binding, etc...
  31. public static readonly DependencyProperty RecenterZoomboxProperty =
  32. DependencyProperty.Register("RecenterZoombox", typeof(bool), typeof(DrawingViewPort), new PropertyMetadata(false));
  33. public ICommand MiddleMouseClickedCommand
  34. {
  35. get { return (ICommand)GetValue(MiddleMouseClickedCommandProperty); }
  36. set { SetValue(MiddleMouseClickedCommandProperty, value); }
  37. }
  38. // Using a DependencyProperty as the backing store for MiddleMouseClickedCommand. This enables animation, styling, binding, etc...
  39. public static readonly DependencyProperty MiddleMouseClickedCommandProperty =
  40. DependencyProperty.Register("MiddleMouseClickedCommand", typeof(ICommand), typeof(DrawingViewPort), new PropertyMetadata(default(ICommand)));
  41. public Point ViewportPosition
  42. {
  43. get { return (Point)GetValue(ViewportPositionProperty); }
  44. set { SetValue(ViewportPositionProperty, value); }
  45. }
  46. // Using a DependencyProperty as the backing store for ViewportPosition. This enables animation, styling, binding, etc...
  47. public static readonly DependencyProperty ViewportPositionProperty =
  48. DependencyProperty.Register("ViewportPosition", typeof(Point), typeof(DrawingViewPort), new PropertyMetadata(default(Point)));
  49. public ICommand MouseMoveCommand
  50. {
  51. get { return (ICommand)GetValue(MouseMoveCommandProperty); }
  52. set { SetValue(MouseMoveCommandProperty, value); }
  53. }
  54. // Using a DependencyProperty as the backing store for MouseMoveCommand. This enables animation, styling, binding, etc...
  55. public static readonly DependencyProperty MouseMoveCommandProperty =
  56. DependencyProperty.Register("MouseMoveCommand", typeof(ICommand), typeof(DrawingViewPort), new PropertyMetadata(default(ICommand)));
  57. public ICommand MouseDownCommand
  58. {
  59. get { return (ICommand)GetValue(MouseDownCommandProperty); }
  60. set { SetValue(MouseDownCommandProperty, value); }
  61. }
  62. // Using a DependencyProperty as the backing store for MouseDownCommand. This enables animation, styling, binding, etc...
  63. public static readonly DependencyProperty MouseDownCommandProperty =
  64. DependencyProperty.Register("MouseDownCommand", typeof(ICommand), typeof(DrawingViewPort), new PropertyMetadata(default(ICommand)));
  65. public double MouseXOnCanvas
  66. {
  67. get { return (double)GetValue(MouseXOnCanvasProperty); }
  68. set { SetValue(MouseXOnCanvasProperty, value); }
  69. }
  70. // Using a DependencyProperty as the backing store for MouseXOnCanvas. This enables animation, styling, binding, etc...
  71. public static readonly DependencyProperty MouseXOnCanvasProperty =
  72. DependencyProperty.Register("MouseXOnCanvas", typeof(double), typeof(DrawingViewPort), new PropertyMetadata(0.0));
  73. public double MouseYOnCanvas
  74. {
  75. get { return (double)GetValue(MouseYOnCanvasProperty); }
  76. set { SetValue(MouseYOnCanvasProperty, value); }
  77. }
  78. // Using a DependencyProperty as the backing store for MouseXOnCanvas. This enables animation, styling, binding, etc...
  79. public static readonly DependencyProperty MouseYOnCanvasProperty =
  80. DependencyProperty.Register("MouseYOnCanvas", typeof(double), typeof(DrawingViewPort), new PropertyMetadata(0.0));
  81. public bool GridLinesVisible
  82. {
  83. get { return (bool)GetValue(GridLinesVisibleProperty); }
  84. set { SetValue(GridLinesVisibleProperty, value); }
  85. }
  86. // Using a DependencyProperty as the backing store for GridLinesVisible. This enables animation, styling, binding, etc...
  87. public static readonly DependencyProperty GridLinesVisibleProperty =
  88. DependencyProperty.Register("GridLinesVisible", typeof(bool), typeof(DrawingViewPort), new PropertyMetadata(false));
  89. }
  90. }