scrollviewer

WPF ListView ScrollViewer Double-Click Event

帅比萌擦擦* 提交于 2019-12-01 21:09:02
Doing the below will reproduce my problem: New WPF Project Add ListView Name the listview: x:Name="lvList" Add enough ListViewItems to the ListView to fill the list completely so a vertical scroll-bar appears during run-time. Put this code in the lvList.MouseDoubleClick event Debug.Print("Double-Click happened") Run the application Double-click on the LargeChange area of the scroll-bar (Not the scroll "bar" itself) Notice the Immediate window printing the double-click happened message for the ListView How do I change this behavior so MouseDoubleClick only happens when the mouse is "over" the

Setting the scrollbar position of a ListBox

不问归期 提交于 2019-12-01 16:35:59
Can I programatically set the position of a WPF ListBox's scrollbar? By default, I want it to go in the center. Zamboni To move the vertical scroll bar in a ListBox do the following: Name your list box (x:Name="myListBox") Add Loaded event for the Window (Loaded="Window_Loaded") Implement Loaded event using method: ScrollToVerticalOffset Here is a working sample: XAML: <Window x:Class="ListBoxScrollPosition.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="Window_Loaded" Title="Main Window" Height=

WP7 ScrollViewer Bug When Content Height > 2000px

谁说我不能喝 提交于 2019-12-01 09:10:59
In my project, I use ScrollViewer to show some long height infomation. I use like this: <Grid Grid.Row="1" Height="630"> <ScrollViewer Background="Red" Grid.Row="1"> <Grid> <Rectangle Height="3000" Fill="LightBlue" Width="440"/> </Grid> </ScrollViewer> </Grid> But,unfortunately, the rectagnle don't show completely when scrollView bar's vertical height > 2000. I have tested without Grid as ScrollViewer's content, only with Rectangle, the result is the same. And the bug is also happens with Width. Any you have any idea what's the workaround? how to deal with it? This post is the same issue

Determine the width of the vertical scroll bar in a ScrollViewer

做~自己de王妃 提交于 2019-12-01 07:17:30
I'm using a ScrollViewer to display an Image. The Image has a ScaleTransform set as one of it's LayoutTransforms. I've got it setup to fit the width of the image into the ActualSize of the ScrollViewer. My problem is that if the image height requires the vertical scrollbar to be present (I have it set to Auto) then my image is scaled just a little bit to much. I know how to determine if the scrollbar would be present and how to get the correct scale, but I cannot figure out how to determine what the actual width of the scrollbar is. I guess I could just guess at it, but I'd like something that

Determine the width of the vertical scroll bar in a ScrollViewer

本秂侑毒 提交于 2019-12-01 05:53:16
问题 I'm using a ScrollViewer to display an Image. The Image has a ScaleTransform set as one of it's LayoutTransforms. I've got it setup to fit the width of the image into the ActualSize of the ScrollViewer. My problem is that if the image height requires the vertical scrollbar to be present (I have it set to Auto) then my image is scaled just a little bit to much. I know how to determine if the scrollbar would be present and how to get the correct scale, but I cannot figure out how to determine

Zoom Out Image to fit ScrollViewer Dimensions

£可爱£侵袭症+ 提交于 2019-11-30 23:32:53
I have a little issue with zooming accordingly an image. I have an Image in my XAML, with a ScrollViewer attached so it can be zoomed. Like this : <ScrollViewer x:Name="ImageScrollViewer"> <Image x:Name="ImagePanel" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center"/> </ScrollViewer> What I'd like to do is that, in case the image is too big to fit the image control and needs to be zoomed out (only in this case), I'd like to programatically set the ZoomFactor of the ScrollViewer so it fits the Image control. My problem is, I don't really know how could I determine that

How to place a ScrollViewer on top of the content it should scroll

半腔热情 提交于 2019-11-30 13:13:17
I would like to put my ScrollViewer in such a way that it overlaps/sits on top of the content it scrolls. I would set the Opacity of the ScrollViewer so that the content is visible underneath. As far as I understand the default ScrollViewer, this doesn't seem to be possible out of the box since the content is nested inside the ScrollViewer. Any ideas on how to make this work? EDIT: I understand that the ScrollViewer is a Decorator and that the content is not aware of the ScrollViewer. This separation is good and I don't want the content to be aware of the ScrollViewer. What I try to do is a

List Items Vertically on a WrapPanel and take advantage of multiple columns

瘦欲@ 提交于 2019-11-30 11:23:45
I need to list items (all of same size) vertically (with a ScrollViewer). I want the items to spread through x columns if the container is large enough to display x columns I first tried that : <ScrollViewer> <toolkit:WrapPanel Orientation="Horizontal" ItemHeight="30" ItemWidth="100"> <Button Content="1" /> <Button Content="2" /> <Button Content="3" /> <Button Content="4" /> <Button Content="5" /> </toolkit:WrapPanel> </ScrollViewer> Result - The WrapPanel works like I want but my items are ordered from "Left to Right" (not vertically Then I tried to seet the Orientation of the WrapPanel to "

ScrollViewer - Indication of child element scrolled into view

☆樱花仙子☆ 提交于 2019-11-30 10:33:49
Is there an event that is raised when a child is scrolled into view and gives an indication of what child was realized? Of course there is the ScrollChanged event, but it does not provide me with any indication of what element was scrolled into view. Thanks in advance. Edit : Iv'e tried hooking up to the ScrollViewer's RequestBringIntoView Event, but it is never reached. Alternatively I also tried the same on the StackPanel containing the items as such: XAML : <ScrollViewer RequestBringIntoView="ScrollViewer_RequestBringIntoView" > <StackPanel RequestBringIntoView="StackPanel

WPF: Canvas swallowing MouseDownEvent?

大憨熊 提交于 2019-11-30 09:35:46
问题 Can anybody please explain to me why the MouseDown event is not reaching the ScrollViewer in this easy example? <Window x:Class="MouseDownTest.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 Name="scrollViewer" Background="Green" MouseDown="ScrollViewer_MouseDown" PreviewMouseDown="ScrollViewer_PreviewMouseDown"> <Canvas Name="canvas"