示例#1
0
 private void _content_Loaded(object sender, RoutedEventArgs e)
 {
     _scrollViewer = _content.GetScrollViewer();
     if (_scrollViewer != null)
     {
         _scrollViewer.DirectManipulationStarted   += ScrollViewer_DirectManipulationStarted;
         _scrollViewer.DirectManipulationCompleted += ScrollViewer_DirectManipulationCompleted;
         var border = (Border)VisualTreeHelper.GetChild(_scrollViewer, 0);
         if (border == null)
         {
             _scrollViewer.Loaded += ScrollViewer_Loaded;
         }
         else
         {
             ScrollViewer_Loaded(this, null);
         }
     }
     else
     {
         throw new InvalidOperationException("content's first child must be ScrollViewer");
     }
 }