I have a situation in which ScrollViewer is set in the base class (Window) and my user control is dynamicaly added as a content of the window. Now, I want one of the controls (ToolBar) in my user control to be excluded from scrolling (to stay visible on top). I know there is a property HandlesScrolling on the Control class but it is internal. I have no way to put the toolbar outside the ScrollViewer because I don’t have access to it.
Is there any way to do this?
I have a situation in which ScrollViewer is set in the base class (
Share
The only way I can think to do that is to make your control size itself to the outer
ScrollViewerand then have its own innerScrollViewerto handle scrolling. There’s some example code below but the key is binding theHeightof your control to theActualHeightof the outerScrollerViewerlike this:Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type ScrollViewer}}}"Outer Scrollviewer:
Your Control: