scrollviewer

How do I add an extended class ScrollViewer to the XAML file?

你。 提交于 2019-12-11 09:09:01
问题 I was looking for a way to animate the scrolling of a ScrollViewer and I found a sample, but when I try to add the class to the XAML file I get an error: Error 2 The type 'AniScrollViewer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. this is the code I found in a forum and I added the class to my cs file: public class AniScrollViewer:ScrollViewer { public static DependencyProperty CurrentVerticalOffsetProperty =

Bubbling up / redirect event to parent ScrollViewer

放肆的年华 提交于 2019-12-11 08:26:14
问题 I hope someone have a hint/solution to solve this problem in a better and more performant way. I'm writting an Windows UWP app with contains a ScrollViewer with a grid. In this grid I have two StackPanels embedded in a ScrollViewer. Each StackPanel has a list of images in a vertical orientation. The StackPanel is as height as all images are together so there is no vertical scrollbar as it should be. On the other hand the images are wider then the StackPanel and the horizontal scrollbar is

SL 4: Monitor properties of ScrollViewer?

ぐ巨炮叔叔 提交于 2019-12-11 07:51:38
问题 We have a Canvas contained in a ScrollViewer. Users can add an unlimited number of UserControls that, to oversimplify, are a RichTextControl surrounded by a number of decorative rectangles. We have an arranger that positions all the UserControls so none overlap. When the arranger runs, it calculates a new position for each UserControl and sets its X and Y on the Canvas. Something is causing the ScrollViewer to scroll, however, so that after the arranger runs the user might have a different

Scrollbar Size in ScrollViewer

隐身守侯 提交于 2019-12-11 05:16:33
问题 How can I programatically determine the width or height of a Scrollbar in the ScrollViewer? Not the current size based on the current state of the ScrollViewer (since I can simply test the visibility of the scrollbar and calculate against the ViewerPortWidth/Height and the ScrollViewer ActualWidth/Height). I need to know what size the Scrollbar's could be based on the templated width. The default is 18 (with a margin of -1). But we all know what could happen if I use the magic number of 18 in

Listbox inside ScrollViewer height calculations

风流意气都作罢 提交于 2019-12-11 04:46:33
问题 When I place a ListBox inside a ScrollViewer, if I do not define a Height attribute for the ListBox, it doesn't scroll (aside from bouncing up and down a bit), so elements off the screen are inaccessible. If I set the Height attribute on the ListBox to the actual height it takes up on the screen, it scrolls perfectly. If I don't get the Height exactly right, it doesn't scroll properly, e.g. I might not be able to reach the bottom elements in the list. When placing other elements in the single

Reaching bottom of ScrollViewer - maximum VerticalOffset value is lower than ScrollableHeight

[亡魂溺海] 提交于 2019-12-11 03:47:19
问题 I have problem with detecting when user reached the bottom of a ScrollViewer. My Code: bool atBottom = scrollViewer.VerticalOffset >= scrollViewer.ScrollableHeight; But sometimes when I reached the bottom of Scrollviewer, value of scrollViewer.VerticalOffset is lower than scrollViewer.ScrollableHeight. It depends on items in listbox, but I dont know how. Do you know, where is the problem? 回答1: You shouldn't use this approach to detect reaching the bottom of the scrollviewer. Instead you

Synchronise 2 scrollviewers silverlight

南笙酒味 提交于 2019-12-11 03:43:29
问题 I want to synchronize 2 scrollviewers. Please let me know how to get scroll event of both scrollviewers and then synchronize them both? 回答1: First get the 2 scrollbars of the scrollviewers you want to sync. In this case, scrollviewer1 and scrollviewer2 Then we get event handlers of both the scrollbars, in this case vertical. Then we can easily sync them through the events. The ScrollToVerticalOffset will scroll as per the other one does. ScrollBar vertical1 = ((FrameworkElement

WPF if the children of a scrollviewer resize, will the scrollviewer automatically update its extent?

痴心易碎 提交于 2019-12-10 23:38:25
问题 So My first question is whether the scrollviewer automatically updates its extent or whether I need to call invalidate measure on scrollviewer to force it to update. Anyway, I have a scrollviewer with a graph inside. When I use a zoom select box I want the axis division unit to change, the scrollviewer's content to change, scrollviewer to recalculate its new extent, and finally to scroll to the correct offset. Currently I have AxisDivisionUnit as a Dependency Property that on update

About re-templating correctly DataGrid

纵然是瞬间 提交于 2019-12-10 21:20:04
问题 I recently had this problem about scrolling and focus changing. I solved it by adding in my DataGrid the following: <DataGrid.Template> <ControlTemplate> <ItemsPresenter /> </ControlTemplate> </DataGrid.Template> The scrolling now works fine, but a new problem appeared: the DataGrid 's headers do not show anymore. It is actually logic, since now my DataGrid will only show an ItemsPresenter without taking care of the headers. I am therefore trying to define an appropriate template, showing

Setting when to scroll in WPF ScrollViewer

柔情痞子 提交于 2019-12-10 20:40:33
问题 I have a scrollviewer that contains a grid with a bunch of form controls in it (textboxes, checkboxes, comboboxes, etc). When I tab through the controls, the scrollviewer will scroll, but only when necessary. By this I mean I tab through all the content in the scrollviewer and only when the control is not visible does the scrollviewer scroll. What I would like to accomplish is having the scrollviewer scroll down when the control is in the bottom 25% of the visible area, and subsequently