MainDrawingPanel.xaml.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using PixiEditor.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. using Xceed.Wpf.Toolkit.Zoombox;
  18. namespace PixiEditor.Views
  19. {
  20. /// <summary>
  21. /// Interaction logic for MainDrawingPanel.xaml
  22. /// </summary>
  23. public partial class MainDrawingPanel : UserControl
  24. {
  25. public MainDrawingPanel()
  26. {
  27. InitializeComponent();
  28. }
  29. public double MouseX
  30. {
  31. get { return (double)GetValue(MouseXProperty); }
  32. set { SetValue(MouseXProperty, value);}
  33. }
  34. // Using a DependencyProperty as the backing store for MouseX. This enables animation, styling, binding, etc...
  35. public static readonly DependencyProperty MouseXProperty =
  36. DependencyProperty.Register("MouseX", typeof(double), typeof(MainDrawingPanel), new PropertyMetadata(null));
  37. public double MouseY
  38. {
  39. get { return (double)GetValue(MouseYProperty); }
  40. set { SetValue(MouseYProperty, value); }
  41. }
  42. // Using a DependencyProperty as the backing store for MouseX. This enables animation, styling, binding, etc...
  43. public static readonly DependencyProperty MouseYProperty =
  44. DependencyProperty.Register("MouseY", typeof(double), typeof(MainDrawingPanel), new PropertyMetadata(null));
  45. public ICommand MouseMoveCommand
  46. {
  47. get { return (ICommand)GetValue(MouseMoveCommandProperty); }
  48. set { SetValue(MouseMoveCommandProperty, value); }
  49. }
  50. // Using a DependencyProperty as the backing store for MouseMoveCommand. This enables animation, styling, binding, etc...
  51. public static readonly DependencyProperty MouseMoveCommandProperty =
  52. DependencyProperty.Register("MouseMoveCommand", typeof(ICommand), typeof(MainDrawingPanel), new PropertyMetadata(null));
  53. public bool CenterOnStart
  54. {
  55. get { return (bool)GetValue(CenterOnStartProperty); }
  56. set { SetValue(CenterOnStartProperty, value); }
  57. }
  58. // Using a DependencyProperty as the backing store for CenterOnStart. This enables animation, styling, binding, etc...
  59. public static readonly DependencyProperty CenterOnStartProperty =
  60. DependencyProperty.Register("CenterOnStart", typeof(bool), typeof(MainDrawingPanel), new PropertyMetadata(false));
  61. public object Item
  62. {
  63. get { return (object)GetValue(ItemProperty); }
  64. set { SetValue(ItemProperty, value); }
  65. }
  66. // Using a DependencyProperty as the backing store for Item. This enables animation, styling, binding, etc...
  67. public static readonly DependencyProperty ItemProperty =
  68. DependencyProperty.Register("Item", typeof(object), typeof(MainDrawingPanel), new PropertyMetadata(0));
  69. private void Zoombox_Loaded(object sender, RoutedEventArgs e)
  70. {
  71. if(CenterOnStart == true)
  72. {
  73. ((Zoombox)sender).CenterContent();
  74. }
  75. }
  76. }
  77. }