scrollviewer

WPF Scrollviewer PanningMode move Window?

烈酒焚心 提交于 2019-12-20 20:34:26
问题 I have add a ScrollViewer in my WPF4 Window with ScrollViewer.PanningMode. When I drag scrollviewer on my multitouch screen it's OK. But... the Window move with scroll when I arrive on top scroll or bottom scroll. How can we avoid this? 回答1: Edit: To complete the answer: There is a native event for this which can just be marked as handled: ManipulationBoundaryFeedback This movement is called boundary feedback which is governed by the operating system (can be set by users in the Pen and Touch

WPF: Get an event on the scrollbar from Scrollviewer

烈酒焚心 提交于 2019-12-20 04:13:26
问题 I want get an event only if I the user drag the scrollbar left or right. When I use a MouseClick event, it contains the whole canvas too... I found that there is an Event Handler "ScrollChanged" but this is not really what I want because the width of my canvas grow every second by 10 and that cause 10 times per second the event ScrollChanged. I want just get an event by draging the scrollbar with the mouse <ScrollViewer x:Name="coordinateScroll" VerticalScrollBarVisibility="Auto"

WPF ListView ScrollViewer Double-Click Event

那年仲夏 提交于 2019-12-20 01:09:01
问题 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

Setting the scrollbar position of a ListBox

流过昼夜 提交于 2019-12-19 14:58:03
问题 Can I programatically set the position of a WPF ListBox's scrollbar? By default, I want it to go in the center. 回答1: 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

Zoom Out Image to fit ScrollViewer Dimensions

谁说我不能喝 提交于 2019-12-19 04:05:18
问题 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

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

北城余情 提交于 2019-12-18 14:30:34
问题 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

C# WPF - ScrollViewer + TextBlock troubles

江枫思渺然 提交于 2019-12-18 12:50:34
问题 I have a TextBlock within a ScrollViewer that aligns with stretch to its window. I need the TextBlock to behave as the following: Resizes with window, no scrollbars When resized below a certain width the TextBlock needs to keep a MinWidth and scrollbars should appear TextWrapping or TextTrimming should work appropriately How can I get this functionality? I have tried several ways, involving bindings to ActualWidth & ActualHeight , but can't get it to work. This can't be that difficult, what

Stop WPF ScrollViewer automatically scrolling to perceived content

此生再无相见时 提交于 2019-12-18 12:15:23
问题 The Application I am building an application which includes a range selector. This consists of two custom drawn Slider controls contained within one UserControl derived class. The range selector control is then contained inside a ScrollViewer which has the HorizonalScrollBar visible most of the time. Sample Application Code: ( appologies for the wall of text ) Window.xaml ( the Window file ): <Grid> <ScrollViewer x:Name="ScrollViewer" HorizontalScrollBarVisibility="Visible"

ScrollViewer is not working in WPF WindowsFormHost

☆樱花仙子☆ 提交于 2019-12-18 11:57:11
问题 I have WindowsFormHost with a RichTextBox in my WPF form, i have given ScrollViewer for that WindowsFormHost but its not working, WindowsFormHost going outside of ScrollViewer... My XAML is.. <ScrollViewer Background="DarkOrange" VerticalScrollBarVisibility="Auto" Height="80" MaxHeight="85" Margin="11,243,12,218" Width="756"> <Canvas Height="100" Name="canvas1" Width="auto" > <WindowsFormsHost ClipToBounds="True" Height="120" Width="715" Margin="10,5,0,0" Name="winHostTEst" Background="Gray">

How does WPF DataGrid get frozen rows/columns working?

雨燕双飞 提交于 2019-12-17 20:48:31
问题 I created a user control based on Grid (not DataGrid), which is wrapped in a ScrollViewer. Now I would like to have frozen rows/columns capability just like in DataGrid, but couldn't figure out how. Can somebody give me some insight how it is done in WPF DataGrid? 回答1: After having this problem by myself I want to share what I've found out so far. DataGrid uses two different methods for that. First: The RowHeader This is the simplified Template for DataGridRow : <Border x:Name="DGR_Border" ..