Is there a way to get push to scroll functionality in Windows 8 metro Apps?

后端 未结 2 746
南方客
南方客 2021-01-22 20:13

In the Windows 8 Consumer Preview, moving the mouse towards the left or right edge in the start screen causes the content to scroll.

The standard controls (and currently

相关标签:
2条回答
  • 2021-01-22 21:04

    I asked this question at TechEd North America this year, after one of the sessions given by Paul Gusmorino, a lead program manager for the UI platform.

    His answer was that no, apps can't do push-against-the-edge-to-scroll. WinJS and WinRT/XAML apps don't even get the events you would need to implement it yourself. Apps get events at the level of the mouse pointer, and once the mouse pointer hits the edge of the screen, it can't move any farther and you don't get any more events. (Well, it might wiggle up and down a little bit, but not if it hit a corner. At any rate, it's not good enough to scroll the way the Start screen does.)

    He mentioned that, if you were writing a C++/DirectX app, you would be able to get the raw mouse input you needed to do this yourself -- you can get low-level "device moved by DX,DY" rather than the high-level "pointer moved to X,Y". I'm guessing this is how the Start screen does it, though I didn't think to ask.

    But no, it's not built-in, it's not something you can implement yourself (unless you write your app in low-level C++/DirectX), and it sounds like they have no plans to add it before Windows 8 ships.

    Personally, I think it's pretty short-sighted of them to have apps feel cripped compared to the Start screen, but evidently they're not concerned about little things like usability. </rant>

    0 讨论(0)
  • 2021-01-22 21:08

    You can do the following to get information on mouse moving beyond the screen and use the delta information to scroll your content.

    using Windows.Devices.Input;
    
    var mouse = MouseDevice.GetForCurrentView();
    mouse.MouseMoved += mouse_MouseMoved;
    
    private void mouse_MouseMoved(MouseDevice sender, MouseEventArgs args)
    {
        tb.Text = args.MouseDelta.X.ToString();
    }
    
    0 讨论(0)
提交回复
热议问题