Skip to content

GridSplitter does not capture input #2719

Open
@stefankueng

Description

@stefankueng

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one)

Current behavior

When moving a GridSplitter, the mouse pointer often moves outside the GridSplitter-Area, which is expected. But when that happens, the controls beside the GridSplitter still get pointer events.

Expected behavior

I would expect other controls to not receive pointer events at all during dragging a GridSplitter.

Minimal reproduction of the problem with instructions

Minimal Project: Create new "Windows Template Studio" c# project in VS, project type "Blank", leave the rest as default. Then edit the MainPage.xaml:

<Page
    x:Class="App1.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
    Style="{StaticResource PageStyle}"
    mc:Ignorable="d">
    <Grid
        x:Name="ContentArea"
        Margin="{StaticResource MediumLeftRightMargin}">
        <Grid.RowDefinitions>
            <RowDefinition Height="40*"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="40*"/>
        </Grid.RowDefinitions>

        <Grid x:Name="top" PointerMoved="Top_PointerMoved" Background="White" ManipulationMode="All" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
        <controls:GridSplitter x:Name="splitter" Grid.Row="1"/>
        <Grid x:Name="bottom" Grid.Row="2" PointerMoved="Bottom_PointerMoved" Background="AliceBlue" ManipulationMode="All" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
    </Grid>
</Page>

Views.zip

and in the code-behind (MainPage.xaml.cs):

private void Top_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("pointer moved top");
}

private void Bottom_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("pointer moved bottom");
}

Run the project, then move the GridSplitter. You'll get lots of debug messages printed while dragging the splitter.

Environment

Nuget Package(s): 
Microsoft.Toolkit.Uwp.UI.Controls

Package Version(s): 
latest stable: 5.0.0

Windows 10 Build Number:
- [x] October 2018 Update (17763)

App min and target version:
- [x] April 2018 Update (17134)
- [x] October 2018 Update (17763)

Device form factor:
- [x] Desktop

Visual Studio 
- [x] 2017 (version: 15.9.4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛An unexpected issue that highlights incorrect behaviorno-recent-activity 📉Open Issues that require attention

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions