Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (e.LeftButton == MouseButtonState.Released)
- return;
- e.GetPosition(this);
- <Canvas x:Name="canvas" Background="Transparent" Height="{Binding ElementName=image}" Width="{Binding ElementName=image}" >
- <dxmvvm:Interaction.Behaviors>
- <dxmvvm:EventToCommand EventName="MouseDown" Command="{Binding MouseDownCommand, Source={x:Static VM:VMDrawing.instance}}" PassEventArgsToCommand="True" >
- <dxmvvm:EventToCommand.EventArgsConverter>
- <converter:MouseEventConverter/>
- </dxmvvm:EventToCommand.EventArgsConverter>
- </dxmvvm:EventToCommand>
- </dxmvvm:Interaction.Behaviors>
- </Canvas>
- public class MouseEventConverter : EventArgsConverterBase<MouseEventArgs>
- {
- protected override object Convert(object sender, MouseEventArgs args)
- {
- var canvas = sender as Canvas;
- return args.Button;
- }
- }
- public VMDrawing()
- {
- MouseDownCommand = new DelegateCommand<object>(MouseDownEvent, true);
- }
- private void MouseDownEvent(object obj)
- {
- try
- {
- Debug.WriteLine("called");
- //check if the obj is null or not
- if (obj == null) return;
- Debug.WriteLine(obj.GetType());
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- Debug.WriteLine(ex.StackTrace);
- throw ex;
- }
- }
Add Comment
Please, Sign In to add comment