wpf - Prevent ScrollViewer scrolling -
how can prevent wpf (3.5) treeview scroll event?
there scrollviewer_scrollchanged
event, not good, called after scroll happened, can undo scroll, not prevent.
looking (pseudo):
scrollviewer_scrollchanging(eventparam e) { if (...) e.cancel = true; }
thanks
edit
i want have scrollbars, , user should able scroll, except when condition happens if (...)
- then prevent scroll dynamically.
more precisely, want scrollbars have only integer position, if user scrolls 1000.45, should adjusted 1000.
because otherwise wpf has rendering problems bitmap in tree...
if allow scroll position integer only, rendering seems ok.
(no, snaptodevicepixels not help, , no, cannot use layourouding)
the workaround can this:
private void treeview_previewmouseleftbuttondown(object sender, mousebuttoneventargs e) { if (e.originalsource system.windows.controls.border) { ...your code } } private void treeview_previewmousewheel(object sender, mousewheeleventargs e) { ...your code }
Comments
Post a Comment