/// <summary> /// Method synchronizes vertical scrollbar in RichTextBoxes components /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RichTextBox_ScrollChanged(object sender, ScrollChangedEventArgs e) { var textToSync = (sender == richTextBoxLines) ? richTextBoxNumbers : richTextBoxLines; textToSync.ScrollToVerticalOffset(e.VerticalOffset); textToSync.ScrollToHorizontalOffset(e.HorizontalOffset); }
private void AutoScrollListBox_ScrollChanged(object sender, ScrollChangedEventArgs e) { try { var scrollViewer = sender as ScrollViewer; if (scrollViewer == null) { return; } var ratio = scrollViewer.VerticalOffset / scrollViewer.ScrollableHeight; if (ratio >= 0.9) //if (scrollViewer.VerticalOffset >= scrollViewer.ScrollableHeight) { if (LazyLoadCommand != null && LazyLoadCommand.CanExecute(null)) { LazyLoadCommand.Execute(null); } } //Debug.WriteLine(scrollViewer.HorizontalOffset + " / " + scrollViewer.ScrollableWidth + " -- " + scrollViewer.VerticalOffset + " / " + scrollViewer.ScrollableHeight + " (" + (scrollViewer.VerticalOffset / scrollViewer.ScrollableHeight) + ")"); } catch (Exception ex) { Debug.WriteLine("AutoScrollListBox_ScrollChanged: " + ex); throw; } }
public void ScrollViewer_ScrollChanged( object sender, ScrollChangedEventArgs ev ) { if ( ev.Source.GetType( ) == typeof( ScrollViewer ) ) { return; } // Calculate scrollbar situation before the scroll change double oldVh = ev.ViewportHeight - ev.ViewportHeightChange; double oldVo = ev.VerticalOffset - ev.VerticalChange; double oldEh = ev.ExtentHeight - ev.ExtentHeightChange; var oldNeeded = ( oldEh >= oldVh ); var oldAtBottom = Math.Abs( ( oldVh + oldVo ) - oldEh ) < 0.01; // Calculate scrollbar situation after the scroll change double newVh = ev.ViewportHeight; double newVo = ev.VerticalOffset; double newEh = ev.ExtentHeight; var newNeeded = ( newEh >= newVh ); var newAtBottom = Math.Abs( ( newVh + newVo ) - newEh ) < 0.01; if ( ( !oldNeeded && newNeeded ) || ( oldAtBottom && !newAtBottom ) ) { Dispatcher.BeginInvoke( (Action) ScrollViewer.ScrollToBottom ); } }
protected override void OnScrollChanged(ScrollChangedEventArgs e) { base.OnScrollChanged(e); var panel = Content as Panel; if (panel == null) { return; } var viewport = new Rect(new Point(0, 0), RenderSize); foreach (UIElement child in panel.Children) { if (!child.IsVisible) { SetIsInViewport(child, false); continue; } var transform = child.TransformToAncestor(this); var childBounds = transform.TransformBounds(new Rect(new Point(0, 0), child.RenderSize)); SetIsInViewport(child, viewport.IntersectsWith(childBounds)); } }
protected override void OnScrollChanged(ScrollChangedEventArgs e) { HorizontalPosition = HorizontalOffset; VerticalPosition = VerticalOffset; HorizontalMax = ScrollableWidth; VerticalMax = ScrollableHeight; }
/// <summary> /// Fix horizontal offset on scrolling changes. /// </summary> /// <param name="e"></param> protected override void OnScrollChanged(ScrollChangedEventArgs e) { //if( e.HorizontalChange != 0 ) this.ScrollToHorizontalOffset(fixedHorizontalOffset); base.OnScrollChanged(e); }
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { var scrollViewer = (ScrollViewer)sender; // User scroll event : set or unset autoscroll mode if (e.ExtentHeightChange == 0) { // Content unchanged : user scroll event if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight) { // Scroll bar is in bottom // Set autoscroll mode _autoScroll = true; } else { // Scroll bar isn't in bottom // Unset autoscroll mode _autoScroll = false; } } // Content scroll event : autoscroll eventually if (_autoScroll && e.ExtentHeightChange != 0) { // Content changed and autoscroll mode set // Autoscroll scrollViewer.ScrollToVerticalOffset(scrollViewer.ExtentHeight); } }
void HandleScrollChanged (object sender, ScrollChangedEventArgs e) { if (Value != scrollValue) { scrollValue = Value; Context.InvokeUserCode (EventSink.OnValueChanged); } }
private void DataGrid2_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.HorizontalChange != 0.0f) { ScrollViewer sv = null; Type t = DataGrid2.GetType(); try { sv = t.InvokeMember("InternalScrollHost", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, DataGrid1, null) as ScrollViewer; sv.ScrollToHorizontalOffset(e.HorizontalOffset); } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (e.VerticalChange != 0.0f) { ScrollViewer sv = null; Type t = DataGrid2.GetType(); try { sv = t.InvokeMember("InternalScrollHost", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, DataGrid1, null) as ScrollViewer; sv.ScrollToVerticalOffset(e.VerticalOffset); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void svSetCategoryGroupDisplay_ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = sender as ScrollViewer; bSetCategoryGroupDisplayHorizontal.Width = sv.ViewportWidth * sv.ViewportWidth / sv.ExtentWidth; bSetCategoryGroupDisplayVertical.Height = sv.ViewportHeight * sv.ViewportHeight / sv.ExtentHeight; bSetCategoryGroupDisplayHorizontal.Margin = new Thickness(sv.ViewportWidth * sv.HorizontalOffset / sv.ExtentWidth, 0, 0, 0); bSetCategoryGroupDisplayVertical.Margin = new Thickness(0, sv.ViewportHeight * sv.VerticalOffset / sv.ExtentHeight, 0, 0); bOpacityLayerLeft.Visibility = bOpacityLayerRight.Visibility = System.Windows.Visibility.Visible; if (bSetCategoryGroupDisplayHorizontal.Width >= sv.ViewportWidth) bOpacityLayerLeft.Visibility = bOpacityLayerRight.Visibility = System.Windows.Visibility.Collapsed; else if (bSetCategoryGroupDisplayHorizontal.Margin.Left <= 0) bOpacityLayerLeft.Visibility = System.Windows.Visibility.Collapsed; else if (bSetCategoryGroupDisplayHorizontal.Margin.Left + bSetCategoryGroupDisplayHorizontal.Width >= sv.ViewportWidth) bOpacityLayerRight.Visibility = System.Windows.Visibility.Collapsed; bOpacityLayerTop.Visibility = bOpacityLayerBottom.Visibility = System.Windows.Visibility.Visible; if (bSetCategoryGroupDisplayVertical.Height >= sv.ViewportHeight) bOpacityLayerTop.Visibility = bOpacityLayerBottom.Visibility = System.Windows.Visibility.Collapsed; else if (bSetCategoryGroupDisplayVertical.Margin.Top <= 0) bOpacityLayerTop.Visibility = System.Windows.Visibility.Collapsed; else if (bSetCategoryGroupDisplayVertical.Margin.Top + bSetCategoryGroupDisplayVertical.Height >= sv.ViewportHeight) bOpacityLayerBottom.Visibility = System.Windows.Visibility.Collapsed; }
private static void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.VerticalChange != 0 || e.HorizontalChange != 0) { var changedScrollViewer = sender as ScrollViewer; Scroll(changedScrollViewer); } }
private void ChangesetHistoryGrid_ScrollChanged(object sender, ScrollChangedEventArgs e) { var scrollViewer = UIHelper.FindChild<ScrollViewer>(this, "GraphScrollViewer"); scrollViewer.ScrollToVerticalOffset(Math.Floor(e.VerticalOffset) * 24); var dataGrid = UIHelper.FindChild<DataGrid>(this, "ChangesetHistoryGrid"); scrollViewer.Height = Math.Abs(dataGrid.ActualHeight - 24); }
private void scrollBar_ScrollChanged(object sender, ScrollChangedEventArgs e) { if(!_suppressScroll) { scrollBarV.ScrollToVerticalOffset(e.VerticalOffset); scrollBarH.ScrollToHorizontalOffset(e.HorizontalOffset); } }
void ScrollChanged(object sender, ScrollChangedEventArgs e) { _isAtEnd = e.ExtentHeight - (e.VerticalOffset + e.ViewportHeight) <= 1.0; if (!_isAtEnd && e.VerticalOffset == lastVerticalOffset) _scrollViewer.ScrollToEnd(); lastVerticalOffset = e.VerticalOffset; }
private static void OnHScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.HorizontalChange != 0) { var changedScrollViewer = sender as ScrollViewer; ApplyHScroll(changedScrollViewer); } }
private void ScrollViewer_OnScrollChanged(object sender, ScrollChangedEventArgs e) { try { this.MarkdownPreview.InvokeScript("setVerticalScrollPosition", ((TextBox)sender).VerticalOffset); } catch (Exception exn) { Console.WriteLine(exn.Message); } }
void _scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (_scrollViewer == null || LoadMoreCommand == null) return; if (e.VerticalOffset == _scrollViewer.ScrollableHeight && e.VerticalChange != 0) LoadMoreCommand.Execute(null); }
/// <summary> /// Load movies if control has reached bottom position /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args</param> private async void ScrollViewerScrollChanged(object sender, ScrollChangedEventArgs e) { var totalHeight = e.VerticalOffset + e.ViewportHeight; if (!totalHeight.Equals(e.ExtentHeight)) return; var vm = DataContext as PopularTabViewModel; if (vm != null && !vm.IsLoadingMovies) await vm.LoadMoviesAsync(); }
private void List_ScrollChanged(object sender, ScrollChangedEventArgs e) { var vm = this.DataContext as TimelineListCoreViewModel; if (vm == null) return; var sv = GetScrollViewer(this.List); if (sv != null) vm.ScrollIndex = (int)sv.VerticalOffset; }
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = sender as ScrollViewer; if (sv.VerticalOffset == sv.ScrollableHeight) { sv.ScrollToEnd();//debug breakpoint } }
private static void smethod1(object sender, ScrollChangedEventArgs e) { if (e.VerticalChange != 0.0 || e.HorizontalChange != 0.0) { ScrollViewer scrollViewer = sender as ScrollViewer; ScrollSynchronizer.smethod2(scrollViewer); } }
private void TimelineScroller_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (AppViewModel.DataViewModel.TopAxisData != null) { AppViewModel.DataViewModel.TopAxisData.Invalidate(); } if (AppViewModel.DataViewModel.BothAxisData != null) { AppViewModel.DataViewModel.BothAxisData.Invalidate(); } if (AppViewModel.DataViewModel.BottomAxisData != null) { AppViewModel.DataViewModel.BottomAxisData.Invalidate(); } if (AppViewModel.DataViewModel.SqueezeAxisData != null) { AppViewModel.DataViewModel.SqueezeAxisData.Invalidate(); } if (AppViewModel.DataViewModel.TopPeriodicData != null) { AppViewModel.DataViewModel.TopPeriodicData.Invalidate(); } if (AppViewModel.DataViewModel.BothPeriodicData != null) { AppViewModel.DataViewModel.BothPeriodicData.Invalidate(); } if (AppViewModel.DataViewModel.BottomPeriodicData != null) { AppViewModel.DataViewModel.BottomPeriodicData.Invalidate(); } if (AppViewModel.DataViewModel.SqueezePeriodicData != null) { AppViewModel.DataViewModel.SqueezePeriodicData.Invalidate(); } if (AppViewModel.DataViewModel.LubeAxisData != null) { AppViewModel.DataViewModel.LubeAxisData.Invalidate(); } if (AppViewModel.DataViewModel.HeatAxisData != null) { AppViewModel.DataViewModel.HeatAxisData.Invalidate(); } if (AppViewModel.DataViewModel.StopAxisData != null) { AppViewModel.DataViewModel.StopAxisData.Invalidate(); } }
private void svScroller_ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = sender as ScrollViewer; bItemsHorizontal.Width = sv.ViewportWidth * sv.ViewportWidth / sv.ExtentWidth; bItemsVertical.Height = sv.ViewportHeight * sv.ViewportHeight / sv.ExtentHeight; bItemsHorizontal.Margin = new Thickness(sv.ViewportWidth * sv.HorizontalOffset / sv.ExtentWidth, 0, 0, 0); bItemsVertical.Margin = new Thickness(0, sv.ViewportHeight * sv.VerticalOffset / sv.ExtentHeight, 0, 0); }
private void ScrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { if (e.OriginalSource != this.DataGridContext.DataGridControl.ScrollViewer) { return; } this.IncrementVersion(new UpdateMeasureRequiredEventArgs(UpdateMeasureTriggeredAction.ScrollViewerChanged)); }
protected override void OnScrollChanged(ScrollChangedEventArgs e) { if (e.HorizontalOffset != HorizontalOffset || e.VerticalOffset != VerticalOffset) { HorizontalOffset = e.HorizontalOffset; VerticalOffset = e.VerticalOffset; base.OnScrollChanged(e); } }
private void ExportLogs_ScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = (ScrollViewer)e.OriginalSource; if (e.VerticalChange > 0 && e.VerticalOffset == sv.ScrollableHeight) { VM.LoadUpLogs(); } }
void ScrollChanged(object sender, ScrollChangedEventArgs e) { // User scroll event : set or unset autoscroll mode if (e.ExtentHeightChange == 0) _doScroll = _scrollViewer.VerticalOffset == _scrollViewer.ScrollableHeight; // Content scroll event : autoscroll eventually if (_doScroll && e.ExtentHeightChange != 0) _scrollViewer.ScrollToVerticalOffset(_scrollViewer.ExtentHeight); }
private void listBox_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.ExtentHeight == e.VerticalOffset + e.ViewportHeight && e.VerticalOffset != 0) { // load more cats //ViewModel.LoadMore((int)e.ExtentHeight); ViewModel.LoadMoreItems.Execute((int)e.ExtentHeight); } }
protected override void OnScrollChanged(ScrollChangedEventArgs e) { base.OnScrollChanged(e); if (e.ExtentHeightChange != 0) { // Content changed ScrollToVerticalOffset(ExtentHeight); } }
private void ListBox_ScrollViewer_ScrollChanged(Object sender, System.Windows.Controls.ScrollChangedEventArgs e) { //if(the user is scrolling horizontality, no reason to run any of our attached behavior code if (e.VerticalChange == 0) { return; } UpdateIndicators(); }
void scrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { int lastOffset = Convert.ToInt32(Application.Current.Properties["FindUserGridLastScrollOffset"] ?? "0"); if (Convert.ToInt32(e.VerticalOffset) > 0 && Convert.ToInt32(e.VerticalOffset) > lastOffset) { Application.Current.Properties["FindUserGridLastScrollOffset"] = e.VerticalOffset; Application.Current.Properties["FindUserGridCurrentPageIndex"] = Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0") + 1; DelegateEventCustomer.SetValueMethodPageNumber(Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0")); } }
private void CheckScrollState(object sender, ScrollChangedEventArgs e) { var scroll = (ScrollViewer)sender; var vo = scroll.VerticalOffset; var maxvo = scroll.ExtentHeight - scroll.ViewportHeight; if (vo.Equals(maxvo)) { LoadNext(this, null); } }
void ViewScrollChanged(object sender, ScrollChangedEventArgs e) { ScrollViewer sv = e.OriginalSource as ScrollViewer; topTreeScrollViewer = topTreeScrollViewer ?? topTree.GetScrollViewer(); leftTreeScrollViewer = leftTreeScrollViewer ?? leftTree.GetScrollViewer(); if (sv == this.scrollViewer) { topTreeScrollViewer.SynchronizeScroll(sv, ScrollSyncOption.HorizontalToVertical); leftTreeScrollViewer.SynchronizeScroll(sv, ScrollSyncOption.Vertical); } }
void scrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { var scrollViewer = (ScrollViewer)sender; int lastOffset = Convert.ToInt32(Application.Current.Properties["FindUserGridLastScrollOffset"] ?? "0"); if (Convert.ToInt32(e.VerticalOffset) > 0 && Convert.ToInt32(e.VerticalOffset) > lastOffset) { Application.Current.Properties["FindUserGridLastScrollOffset"] = e.VerticalOffset; if ((scrollViewer.VerticalOffset / scrollViewer.ScrollableHeight) * 100 > 80) { Application.Current.Properties["FindUserGridCurrentPageIndex"] = Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0") + 1; DelegateEventVehicle.SetValueMethodPageNumber(Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0")); } } }
private void mainScrollBar_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { if (scrollBarLock) { return; } scrollBarLock = true; var scrollViewer = (sender as ScrollViewer); if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight && !searchMode) { var list = (from t in FullList select t).Skip(index).Take(index + increment); AddToList(list); index += increment; } scrollBarLock = false; }
// private void ClipboardScrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { if (e.ExtentHeightChange == 0) { if (ClipboardScrollViewer.VerticalOffset == ClipboardScrollViewer.ScrollableHeight) { AutoScrollClipboard = true; } else { AutoScrollClipboard = false; } } if (AutoScrollClipboard && e.ExtentHeightChange != 0) { ClipboardScrollViewer.ScrollToVerticalOffset(ClipboardScrollViewer.ExtentHeight); } }
void scrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { int lastOffset = Convert.ToInt32(Application.Current.Properties["FindUserGridLastScrollOffset"] ?? "0"); var scrollViewer = this.grdBillingList.ChildrenOfType <GridViewScrollViewer>().FirstOrDefault(); if (scrollViewer != null) { // Below decides when to get the records // Implemented the logic that when scrollbar crosses more that half of the total available height var whenToScroll = scrollViewer.ScrollableHeight / 1.3; if (Convert.ToInt32(e.VerticalOffset) > 0 && Convert.ToInt32(e.VerticalOffset) > lastOffset && e.VerticalOffset > whenToScroll) { Application.Current.Properties["FindUserGridLastScrollOffset"] = e.VerticalOffset; Application.Current.Properties["FindUserGridCurrentPageIndex"] = Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0") + 1; DelegateEventBillingPeriod.SetValueMethodPageNumber(Convert.ToInt32(Application.Current.Properties["FindUserGridCurrentPageIndex"] ?? "0")); } } }
private void NotificationsListView_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { if (this.scrollViewer == null) { this.scrollViewer = (ScrollViewer)e.OriginalSource; } if (this.scrollViewer != null) { if (ChannelSession.Settings.LatestChatAtTop) { this.scrollViewer.ScrollToTop(); } else { this.scrollViewer.ScrollToBottom(); } } }
private void ScrollViewer_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { imgTransform.X = -((ScrollViewer)sender).HorizontalOffset; }
private void NetworkScrollViewr_ScrollChanged(object sender, System.Windows.Controls.ScrollChangedEventArgs e) { }
internal override void OnScrollChanged(ScrollChangedEventArgs e) { HandleInput(e); }