/// <summary> /// Fired the the object is ready, setup the scroll detection. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EndDetectingListView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Get the scroll bars List<DependencyObject> scrollBars = new List<DependencyObject>(); UiControlHelpers<ScrollBar>.RecursivelyFindElement(this, ref scrollBars); // Find the scrollbar we want. Fun fact. Since in the scollviewer (which is in the list) the scrollContentPresenter is before the // main scrollbars we will find scrollbars of the header before ours. Ours should always be the last scrollbars in the list. // SO KEEP GOING DON'T BREAK until we find the last vertical scrollbar. foreach(DependencyObject dObject in scrollBars) { if(((ScrollBar)dObject).Orientation == Orientation.Vertical) { m_listeningScrollBar = (ScrollBar)dObject; } } // Make sure we found it if (m_listeningScrollBar == null) { throw new Exception("Failed to find the scroll bar!"); } // Add the listener m_listeningScrollBar.ValueChanged += ScrollBar_ValueChanged; }
private void AttachScrollBar(ScrollViewer scrollViewer) { var scrollBars = scrollViewer.GetDescendantsOfType<ScrollBar>().ToList(); var horizontalBar = scrollBars.FirstOrDefault(temp => temp.Orientation == Orientation.Horizontal); if (horizontalBar != null) { _horizontalBar = horizontalBar; _horizontalBar.ValueChanged += HorizontalBar_ValueChanged; } var verticalBar = scrollBars.FirstOrDefault(temp => temp.Orientation == Orientation.Vertical); if (verticalBar != null) { _verticalBar = verticalBar; _verticalBar.ValueChanged += VerticalBar_ValueChanged; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { int f = 0; EventDetail a = new EventDetail(); ScrollBar s = new ScrollBar(); try { info1 = e.Parameter as Events; a.Desc = info1.Desc; a.Title = info1.Title; a.college = info1.college; a.date = info1.Date.Date.ToString("dd/MM/yyyy"); a.bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(info1.imageUri)); image2.Source = a.bitmapImage; a.issuedBy = info1.issuedBy; a.url = info1.url; a.mobile = info1.mobile; a.Email = info1.email; } catch (Exception) { f = 1; } finally { if (f == 1) { MessageDialog m = new MessageDialog("Oops... There was some Problem Handling your Request"); await m.ShowAsync(); } else { Pivott.DataContext = a; } } }
public ScrollBarEvents(ScrollBar This) : base(This) { this.This = This; }