473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WPF: Scrolling the screen using the scrollwheel when mouse is over a listbox.

Telinstryata
I have a WPF user control with the following...

a) A ListBox on the left of the screen
b) A TextBox on the right of the screen
c) A ScrollViewer around both

When my mouse is over the TextBox and I use the scrollwheel, the TextBox scrolls. When I scroll to the bottom of the TextBox the ScrollViewer then takes over and scrolls.

When my mouse is over the ListBox and I use the scrollwheel, the ListBox scrolls. When I scroll to the bottom of the ListBox the ScrollViewer does not take over and does not scroll.

The following is a little test window that shows this functionality (my real code is far to long to use as an example)

Expand|Select|Wrap|Line Numbers
  1. <Window x:Class="Scroll"
  2.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.     Title="Scroll" Height="100" Width="300">
  5.     <Grid>
  6.         <ScrollViewer Name="ScrollViewer1">
  7.             <Grid>
  8.                 <Grid.ColumnDefinitions>
  9.                     <ColumnDefinition Width="Auto" />
  10.                     <ColumnDefinition Width="*" />
  11.                 </Grid.ColumnDefinitions>
  12.                 <ListBox MaxHeight="200" VerticalAlignment="Top" HorizontalAlignment="Left">
  13.                     <ListBoxItem Content="Item 0" FontSize="30" />
  14.                     <ListBoxItem Content="Item 1" FontSize="30" />
  15.                     <ListBoxItem Content="Item 2" FontSize="30" />
  16.                     <ListBoxItem Content="Item 3" FontSize="30" />
  17.                     <ListBoxItem Content="Item 4" FontSize="30" />
  18.                     <ListBoxItem Content="Item 5" FontSize="30" />
  19.                     <ListBoxItem Content="Item 6" FontSize="30" />
  20.                     <ListBoxItem Content="Item 7" FontSize="30" />
  21.                 </ListBox>
  22.  
  23.                 <TextBox Height="200" Grid.Column="1" TextWrapping="Wrap" FontSize="30"
  24.                          VerticalScrollBarVisibility="Auto">This is some text used to fill up the text box with small words. blah blah blah blah blah.</TextBox>
  25.             </Grid>
  26.         </ScrollViewer>
  27.     </Grid>
  28. </Window>
  29.  
Is there any way to get the scroll event on the ListBox to be passed onto the ScrollViewer just like it is with the TextBox
Aug 12 '10 #1
0 1839

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Targa | last post by:
I know you can do an onmouseover/onmouseout to display alternate text for links but Im looking for a script that would cover all links on a page without having to add code to each link. Is there...
5
by: Martha | last post by:
When I move my mouse over a hyperlink component, the hyperlink does not change color. How do I change the color of a hyperlink when the mouse goes over the hyperlink? or Change the color of a...
2
by: i-cable hk | last post by:
Hi, I would like to ask say in www.yahoo.com When mouse over a link, the link become "underlined". When mouse leave a link, the underline disappear. How to do? Thanks
2
by: i-cable hk | last post by:
Hi, I would like to ask say in www.yahoo.com When mouse over a link, the link become "underlined". When mouse leave a link, the underline disappear. How to do? Thanks
1
by: nikou_70 | last post by:
I have a page with image, image has some image map, I want to submit form when user mouseover that image map, my code is like this: <img src="Images/floor4.jpg"usemap="#planetmap" id="IMG1">...
3
by: Eric Layman | last post by:
Hi everyone. An image allows alt attribute. When mouse over images with alt attribute, a small yellow popup would appear besides the mouse cursor. How to replicate this behaviour using a table...
5
by: prebeni | last post by:
Hi I'm new into vb.net - so please forgive me :-) It's in a windows form - in visual basic 2005. How do I make a small text be visual when the user move the mouse over a button? In html you can...
1
by: sonysunny | last post by:
How can we display a box (like tool tip, bigger than tool tip box and can be customised) when mouse is placed over an image and disappear wen mouse removed from that image. Using javascript. ...
2
by: chaudharygaurav2 | last post by:
can u provide a code for this problem problem is.---------- i want to use a linktext 'mobile' when mouse move over it it show all the optoin to link for example nokia,motorola,spice,lg,samsung...
9
by: nghivo | last post by:
I notice that when the mouse is over a column header of a listview control, that column header is focused (or highlighted). In this case, what event is fired ? The reason I ask is I have listview...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.