.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Multitouch with ScrollViewer

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :WPF

I have recently been experimenting with multi touch in WPF 4 and have managed to get something working using a combination of:






The problems start when I wrap the control being manipulated in a ScrollViewer and set PanningMode to Both.

I can pan the ScrollViewer around fine but all other manipulations like rotate and scale seem to be lost.

Is it just me or is there a problem here?



View Complete Post

More Related Resource Links

Inside Windows 7: MultiTouch Capabilities in Windows 7


This is Part 3 of a multipart article series on Windows 7. Part 3 covers the Windows 7 multitouch capabilities.

Yochay Kiriaty

MSDN Magazine August 2009

System.AddIn, simultaneous multitouch interaction in multiple addins

Hello, I have built an application that is able to load several addins, each having their own process, each sending their own UI onto the application's UI. I now would like to enable simultaneous multitouch interaction in any of these AddIns' UIs. The problem is: when there is multitouch interaction ongoing in one of the addins' UI, the others do not seem to receive any event, even though I try to touch controls in them. My question is: is this even possible in the current form of the framework? Or does the input device (i.e. my touch screen) get somehow "captured" by the currently manipulated UI's process, thus preventing the others from getting any input at all? Antoine

WPF 4 Multitouch not working with SAW

Hi guys, i was just trying to use my multitouch screen (SAW panel) input device with WPF 4, the multitouch input work perfectely on windows 7, in fact i can zoom and scroll other windows apps, but on wpf no event get fired, the same app work on another pc with Infrared touch panel. Any guess why is this happening? Thanks

Changing Mouse Cursor into Crossed Circle in ListBox-ScrollBar/ScrollViewer(on Drag and Drop).

Hi All,   I have a ListBox with 10 items, the automatic Scrollbar/ScrollViewer is appearing. If i'm dragging an item from the listbox and moving the mouse cursor on top scrollbar/scrollviewer the cusor have to change into CROSSED CIRCLE(means its not a location to drop). Can any one help to do the same, or please let me know if more info needed.   Thanks, Karthikeyan Manickam.

Minwidth with Scrollviewer to then take over

Morning Guys and Gals, I'm having trouble with my code (again) and I would like some help please. I am trying to get text that is in a groupbox to wrap until a minimum width and the a scrollviewer to take over when the miniumum width is reached. This is what I have so far to no avail. <Window x:Class="TextScrollviewer.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"> <Grid> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <TextBlock TextWrapping="Wrap" MinWidth="300">Some Loooooooooooooooooong amount of text for something that won't all fit nicely on the page and its annoying me that I can't fix it, please help!</TextBlock> </ScrollViewer> </Grid> </Window>   All help is greatly apreciated; if I've not made it clear enough what I would like please just leave a comment and I will try and explain it in a different way. Thanks in Advance Alex

Multitouch manipulation on Drag and Drop objects.

Dear WPF experts, I have developed few simple multi touch applications where I can manipulate like pan,zoom and rotate the multiple images and Multiple videos at a same time. Now I am working on Multitouch application where i could able  to drag and drop the media files and images in an application, but could not able to manipulate the objects using manipulation after dropping the object in the target. In fact I could not able to drag an object by setting "IsManipulationEnabled=True" to a canvas container. Could anyone help me out how can we manipulate a Drag and Drop object. Thank you, in advance

Weird Exception: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizon

Hi guys I have an XBAP application that uses a Xamdatagrid from Infragistics. I have some filtering on this grid, that rebinds after a filter. The problem is, when a user has scrolled to a certain point and then filters, the rebinding causes the grid to scroll to the beginning position of the grid. Now how I solve this is by getting an instance of the ScrollViewer, I get the ScrollViewer.ContentHorizontalOffset and then I do a ScrollViewer.ScrollToHorizontalOffset after it filters.   Now here comes the problem. For 99% of the users of this xbap app, this will work absolutely fine. Most, if not all of the users run exactly the same machines, XP 64 bit with 8GB RAM. The other 1% get the error: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizontalOffset()'. I cannot reproduce this error on my own box, our dev server or our production server, it is a phantom exception that only pops up on a certain condition. I have even wrapped the "offending" code in a try catch and it still doesn't solve it. If I set the DispatcherUnhandledExceptionArgs Handled to true, it works, but it doesn't feel right. How is this possible? If the method doesn't exist, how can it compile? Why does that method exist for 99% of the other users running the exact same machines? I have googled my fingers raw without any valid results and this issue is frustrat

How can I stop a WinFormsHosted control from scrolling over my ScrollViewer?

I have a WPF application where the main window contains a NavigatorFrame and a ScrollViewer, like so: <ScrollViewer x:Name="scrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" > <MainWindow:NavigatorFrame x:Name="navigatorFrame" Background="{StaticResource windowBackground}" IsTabStop="False" NavigationUIVisibility="Hidden" > .... </MainWindow:NavigatorFrame> </ScrollViewer> I use the NavigatorFrame to display WPF Pages, and one of the Pages contains two WinFormsHost controls that each contain a WinForms SyntaxEditor (from Actipro). Unfortunately, when I try to scroll using the ScrollViewer, the WinForms editors move above the scrollbars and overlap other controls in my application. When I remove the ScrollViewer, the SyntaxEditors go back to behaving (except their Page doesn't have scrollbars). My understanding is that WinFormsHosts have a ZOrder that causes them to appear over WPF elements, which may explain this issue. Nevertheless, I'm wondering if

ScrollViewer scales (almost) into infinity


Hi there,

I have a problem with a simple scrollviewer around a datagrid. I want the datagrid to fit to the window size, so I set the width of my datagrid columns to "*". See my code below:



<Window x:Class="ScrollViewerProblem.MainWindow"
 <Style TargetType="{x:Type DataGrid}">
  <Setter Property="ClipToBounds" Value="True" />
  <Setter Property="CanUserResizeRows" Value="False" />
  <Setter Property="CanUserReorderColumns" Value="False" />
  <Setter Property="CanUserAddRows" Value="False" />
  <Setter Property="AutoGenerateColumns" Value="False" />
  <Setter Property="SelectionMode" Value="Single" />
  <ColumnDefinition Width="*"/>
  <ColumnDefinition Width="3*"/>
 <TabControl Grid.Column="1">
  <TabItem Header="I am a TabItem">
  <ScrollViewer Vertica

Strange ScrollViewer Behavior



When i use the following code, my scrollviewer appears for both vertical and horizontal. however the up and down arrows, and the left right arrows appear back to back. these buttons work fine. they just look terrible. after all the down button should appear at the bottom of my grid.

Can anyone help me out.



Gary Rusher

<local:BooleanToColorConverter x:Key="BooleanToColorConverter"/>

    <DataTemplate x:Key="BasicComponent">
      <TextBlock Text="{Binding Path=Description}"
            Foreground="{Binding Path=Rendered,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource BooleanToColorConverter}}">
    <HierarchicalDataTemplate x:Key="ComplexComponent"
                 ItemsSource="{Binding Components}">

How to sync a listview control to a scrollviewer


I have two apps, one winform and one WPF, which both use the same code.

On each I have a ListView control.  I have a routine that increments the .SelectedIndex by 1 and performs work on the data for that line in the ListView then goes on to the next.

The ListView control in the WinForm app has its own vert scrollbar and as the program changes the .SelectedIndex the selected line is highlighted and kept visable in the ListView.

In the WPF the ListView does not have its own scrollbar and I have to use a Scrollviewer.  This arrangement does not mimic the WinForm app.  As the ListView items are selected they are highlighted only as long as they are visible on the ListView box.  Once the SelectedItem is beyond teh visable portion of the ListView Control the ScrollViewer does not scroll down to keep it visable.

How do I sink them together so that the SelectedItem is always visable just like the WinForm app????

Binding a scrollviewer height


i'm using a stack of expanders to mimick an accordion control. I have an ItemsControl on the page with it's ItemsSource set to Screens. Here is some sample code for the ViewModel.

	internal class MainWindowViewModel
ObservableCollection<Expander> _screens = new ObservableCollection<Expander>();
public ObservableCollection<Expander> Screens { get { return _screens; } }

internal Dictionary<stringUserControl> AppScreens = new Dictionary<stringUserContr

multitouch layout


hi i would like to build an app which i imagine something as this.. 

a thumbnail bar on my right, when user click or slide the thumbnail it will load the image to the middle of the screen. 

in the middle screen, the picture enable for resize, zoom in/out..

i tried to search online but most of the app provided are too complicated.. i would appreciate if there is there any sample as this. please advice


Visual Studio Express2010 multitouch using Windows XP


Hello to everybody,

I've just downloaded Visual Studio Express 2010 on my WindowsXP computer and I would like to know how and whether I can develop and compile a multitouch application which I'll use on another computer which has Windows7 istalled with a multitouch display.

I would like to create a WPF application in Visual Basic. I tried to insert an Image object and I can see that there are not any multitouch event to associate with functions.

I've read many tutorial on the net before posting this question and it seems that WPF4 (included in VS2010) should have the MT capabilities. Is that true?



Scrollviewer with elements that loop


1) Hi, I was wondering if there was a way to have a scrollviewer with elements that loop.


Let us say I have 4 items.

After scrolling from left to right you see something like this in order:

<item 1> <item 2> <item 3> <item 4> ... <item 1> <item 2>

Also currently I am using a StackPanel inside my scroller.

2) I also have another issue with scrollling... it seems when I click inbetween my images ( the items i have in my scroller), I cannot scroll. I have to directly click on the images to scroll.

3) Is there a way to snap these images whenever I scroll such that, the image closest to the center of the scroller will snap and enlarge in size.

Thanks for the tips :)

ScrollViewer problem


I've created two user controls, one creates me a row with labels and one creates me a row with TextBoxes (i'm trying to create something like dataGrid but with TextBoxes).

I put my users controls in a stackPanel, which is inside of a scrollViewer.

I'm having problems with two things:

1. I want that the scroll viewer will scroll only on the TextBox Rows, so the labels (which represent the headers) will always be visible.

I tried not to put them inside the scrollViewer, but then when I need to scroll Horizontally, the labels are not moving...

2. For some reason, the Horizontal scrollBar appears only when I'm adding the TextBox rows although I gave each TextBox the same width as it's label has.

Below you can find the relevant code:

Thanks a lot,


TextBox User Control:

<Grid x:Name ="weaponsDetailsGrid">
            <ColumnDefinition Width="3" />
            <ColumnDefinition Width="14" />
            <ColumnDefinition Width="2&

scrollviewer not working in nested User Control


The code below illustrates my problem: I cannot get the scrollbars in the embedded User Control (ucScroll1) to show up when I resize the main window (Window1) smaller.

It won't work even if I force the issue by defining it like this:
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" IsEnabled="True" >

<UserControl x:Class="ScrollViewerApp.ucScroll1"



 Height="100" Width="300">

 <StackPanel VerticalAlignment="Top">

  <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >

   <StackPanel Background="Aqua">

    <TextBox Width="100" Mar
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend