c# - Scrollbar shows up in a reverse/opposite direction

问题描述:

I have a WPF application.

I use telerik and in one of the panes I have a WindowsFormsHost to host a winforms.

My problem: whenever I resize the pane in a way that a horizontal scroller becomes visibile, the scroller is behaving in a wierd way: if the scroller is all the way to the right then the winforms/WindowsFormsHost that is displayed is all the way to the left and vise versa.

I have tried playing with snoop, changing the FlowDirection but it doesn't help (and the FlowDirection is always LeftToRight).

After BugFinder's comment I started looking in the whole solution for that code in the xaml/xaml.cs.
When I couldn't find anything I understood that it must be in the Winforms.
Apparently one of the items in the form (which is a tree control) had a:

tree.RightToLeft = RightToLeft.Yes;

Which caused the scroll to act that way (even though the whole tree display was Left to Right).
I understood that the bug was in the tree when I noticed that when I move the scroll it only effects the tree (which takes the whole length) and the toolbar in the form.

Hope this helps someone and thank you BugFinder for guiding me to the solution.