C # wpf scrollviewer not working as windows store app

I am currently working on an application using WPF. And I can not help but notice the differences in the functionality of ScrollViewer compared to the version of the Windows Store application.

When I am on the edge of the screen and the edge of the ScrollViewer, and I want to slide so that I move away from the edge. I see a Windows desktop or menu bar (at the bottom of the screen). Is there a solution to prevent this scroll behavior? This is quite annoying (and ugly!) When you scroll to the edge of the screen and then stumble back and see a small window platform underneath. This behavior has been fixed in the Windows App App ScrollViewer ..

I tried to overwrite ScrollChangedand check if there is fe horizontalOffset == 0 && horizontalChange < 0and check back if that is the case. But this check does not seem to work (since then, perhaps already too late). And I can not find the way Windows Store Apps fixed it.

enter image description here

Perhaps you have an idea?


EDIT: Reproducing WPF Projects in .NET 4.5.1

This part of XAML re-creates my problem in WPF. However, the Windows Store application does not have a problem.

How can I prevent this behavior when scrolling and / or around the edges of my application?

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" ResizeMode="NoResize" WindowState="Maximized" WindowStyle="None">
    <Grid>
        <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" PanningMode="Both">
            <Rectangle Height="2500" Stroke="Black" Width="3500" HorizontalAlignment="Left" VerticalAlignment="Top">
                <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0,0.5">
                        <GradientStop Color="#FF00FF68" Offset="0"/>
                        <GradientStop Color="Red" Offset="1"/>
                        <GradientStop Color="#FF95FF00" Offset="0.506"/>
                    </LinearGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
        </ScrollViewer>

    </Grid>
</Window>
+4
source share
1 answer

Windows 8 , . "", . . , , Windows, . , , - . Windows 8 , , , .

. WinRT.

: . , . , OnManipulationBoundaryFeedback(ManipulationBoundaryFeedbackEventArgs) UIElement :

class NoTouchFeedbackWindow : Window
{
    protected override void OnManipulationBoundaryFeedback(ManipulationBoundaryFeedbackEventArgs e)
    {
        e.Handled = true;
    }
}

ScrollViewer .

:

, .

+4

Source: https://habr.com/ru/post/1532798/


All Articles