質問

I'm trying to find a solution for this problem: I want to make a stackpanel, which scrolling behavior is like that one, which you can find in Windows Store App's stackpanels. That means: if you left click your mouse somewhere within the stackpanel, you can scroll up and down just by moving the mouse up and down. You don't have to use the scrollbar.

Now - back in WPF - I can't find a similar solution for that. I tried to look for some examples in the www, but unfortunately none of the tricks worked. That is all what I got until now:

<ScrollViewer PanningMode="Both" VerticalScrollBarVisibility="Visible" >
        <StackPanel Margin="10">
            <Label Content="Hello world" />
            <Label Content="Hello world " />
             ...
        </StackPanel>
</ScrollViewer>

But that's it. And (surprise) - it does not work :) In other WPF application I have seen, that it is possible.. somehow.

Could you please help me? Thx so far,

CodeCannibal

役に立ちましたか?

解決

This is surprisingly easy to do, there's an example of such behavior on this page. According to a SO duplicate of this question that solution has a memory leak but I'm sure it could be easily tracked down.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top