3

I am writing a GUI application to run on a touchscreen device using VB.NET and WPF--it must be full screen at all times, like a kiosk app; the window must not be able to resize or move in any way. The window contains a ListBox that users can currently scroll through by dragging across the list. The problem I'm seeing is that when the user drags across the list, the whole window moves a bit, exposing the desktop underneath, then springs back into place once the user stops dragging. I have not been able to figure out how to keep the window stationary while still allowing users to drag across the ListBox to view all list items. Here is a somewhat simplified version of my code:

<Window  
  x:Class="MainWindow"  
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="MainWindow"  
  WindowStyle="None"  
  WindowState="Maximized"  
  WindowStartupLocation="CenterScreen"  
  KeyboardNavigation.TabNavigation="None"  
  Topmost="True"  
  Focusable="False"  
  ResizeMode="NoResize"  
  ShowInTaskbar="False"  
  MaxHeight="1080px"  
  MaxWidth="1920px">  
  <Grid>  
     <ListBox
       x:Name="docList"  
       ScrollViewer.HorizontalScrollBarVisibility="Hidden"  
       ScrollViewer.VerticalScrollBarVisibility="Hidden"
       BorderThickness="0">  
       <TextBlock Text="Item1" />  
       <TextBlock Text="Item2" />  
       <TextBlock Text="Item3" />  
       <TextBlock Text="Item4" />  
       <TextBlock Text="Item5" />  
       <TextBlock Text="Item6" />  
     </ListBox>
  </Grid>  
</Window>  
Mr.E
  • 47
  • 1
  • 7
  • Windows does that with touch scroll events. It simulates dragging on something that's scrolled all the way already so you're dragging the window instead. It can be confusing at times (I've seen a program where a text box was a window of its own and the textbox could be dragged slightly out of the “parent” window this way). I don't know of a way to turn that off, though. – Joey Jun 30 '10 at 23:14
  • I've been relying on the system to provide the default touch functionality. Should I capture all touch events and handle them myself? – Mr.E Jul 01 '10 at 18:03

1 Answers1

4

I believe that if you handle the OnManipulationBoundaryFeedback(object sender, TouchEventArgs e) event on the listbox, and set the e.Handled property true, that should prevent the "bounce" of the application window.

It may also be possible (I hadn't thought of it until just now) to handle the event at the Window level, since it is a bubbling event, to mitigate the chance of any other controls causing the same behaviour.

Hugo
  • 1,814
  • 1
  • 15
  • 23