I manually re-calculate my displayed axis ranges when new data points are appended or when a specific portion of the data is selected to view from a ListBox, but I would like to leave the axis ranges as-is if the user has zoomed-in (using the built-in ZoomModifiers). Is there a way for my ViewModel to know this has happened so I can avoid recalculating in that case?
- You must login to post comments
So you want to have an event / know when a user has zoomed via dragging / panning but NOT if the axis range is changed programmatically, is that right?
Well, one way is to override one of our zoom modifiers and add an event. For instance, see How to detect when zoom Rubberband zoom opertion has occured or Event after zoom in. Does that help?
Most of our modifiers override one or more mouse methods, such as
- RubberbandXyZoomModifier uses OnModifierMouseUp to complete the zoom
- ZoomPanModifier uses OnModifierMouseMove and OnModifierMouseUp to complete the zoom
- ZoomExtentsModifier uses OnModifierDoubleClick to perform the zoom.
Finally, if you do override these methods you can add an event, and use EventToCommand to send the message to a Viewmodel.
Does it help?
- Inthe RubberBandXyModifier, I’ve tried adding an EventTrigger on “MouseUp” to call my ViewModel command function, but it doesn’t seem to trigger at all. Should this be working like this or am I doing something wrong? Thanks!
- Hi Matthew, that won’t work! You need to subclass RubberBandXyZoomModifier and override OnModifierMouseUp and add your own event or mechanism to call to view model . Best regards, Andrew
- I’m almost there… I’ve got the custom ZoomModifiers sending an event that the ViewModel handles now. But one more problem. When I double-click for a ZoomExtents, instead it triggers two RubberBand MouseUp events and I never get the ZoomExtents DoubleClick event. Do I need to add something in my custom RubberBand Modifier to prevent this? Thanks!
- Didn’t have the ZoomModifier event handler in place, but even with it in place, it still receives a RubberBand MouseUp, the ZoomExtents DoubleClick, and then another RubberBand MouseUp…
- I think the more accurate question is: Is there a way for me to know if the base RubberBandXyZoomModifer.OnModifierMouseUp() actually was successful so I know to send my corresponding event? (Since if the mouse only moves a small amount, the rubberband zoom won’t occur…)
Please login first to submit.