Guest User

Untitled

a guest
Jan 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. if (e.LeftButton == MouseButtonState.Released)
  2. return;
  3.  
  4. e.GetPosition(this);
  5.  
  6. <Canvas x:Name="canvas" Background="Transparent" Height="{Binding ElementName=image}" Width="{Binding ElementName=image}" >
  7. <dxmvvm:Interaction.Behaviors>
  8. <dxmvvm:EventToCommand EventName="MouseDown" Command="{Binding MouseDownCommand, Source={x:Static VM:VMDrawing.instance}}" PassEventArgsToCommand="True" >
  9. <dxmvvm:EventToCommand.EventArgsConverter>
  10. <converter:MouseEventConverter/>
  11. </dxmvvm:EventToCommand.EventArgsConverter>
  12. </dxmvvm:EventToCommand>
  13. </dxmvvm:Interaction.Behaviors>
  14. </Canvas>
  15.  
  16. public class MouseEventConverter : EventArgsConverterBase<MouseEventArgs>
  17. {
  18. protected override object Convert(object sender, MouseEventArgs args)
  19. {
  20. var canvas = sender as Canvas;
  21.  
  22. return args.Button;
  23. }
  24. }
  25.  
  26. public VMDrawing()
  27. {
  28.  
  29.  
  30. MouseDownCommand = new DelegateCommand<object>(MouseDownEvent, true);
  31. }
  32.  
  33. private void MouseDownEvent(object obj)
  34. {
  35. try
  36. {
  37. Debug.WriteLine("called");
  38. //check if the obj is null or not
  39. if (obj == null) return;
  40. Debug.WriteLine(obj.GetType());
  41.  
  42. }
  43. catch (Exception ex)
  44. {
  45. Debug.WriteLine(ex.Message);
  46. Debug.WriteLine(ex.StackTrace);
  47. throw ex;
  48. }
  49. }
Add Comment
Please, Sign In to add comment