Beispiel #1
0
        void VirtualEarthBase_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            UIElement target = e.TargetObject as UIElement;
            while (target != null
                && target != this
                && (GetLatitude(target) == 0.0
                || GetLongitude(target) == 0.0))
            {
                target = VisualTreeHelper.GetParent(target) as UIElement;
            }
            if (target != null && target != this)
            {
                double lat = GetLatitude(target);
                double lon = GetLongitude(target);

                WorldCoordinate bottomRight = ClientToWorld(new Point(ActualWidth, ActualHeight));

                if (lat > CornerLatitude || lat < bottomRight.Latitude
                    || lon < CornerLongitude || lon > bottomRight.Longitude)
                {
                    ViewLatitude = lat;
                    ViewLongitude = lon;
                }
            }
        }
			private void method_0(object sender, RequestBringIntoViewEventArgs e)
			{
				if (!this.AllowBringIntoView)
				{
					e.Handled = true;
				}
			}
 private void AusleihvorgaengeTab_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     if (ZinssatzComboBox.ItemsSource == null)
     {
         ZinssatzComboBox.ItemsSource = _kundeDetailPresenter.GetAlleZinssaetze();
         AusleihUebersichtAktualisieren();
     }
 }
Beispiel #4
0
        private void OnRequestBringIntoView(object sender, sw.RequestBringIntoViewEventArgs e)
        {
            var h = Handler as IGridHandler;

            if (h == null)
            {
                return;
            }
            e.Handled = h.DisableAutoScrollToSelection;
        }
 void DiagramDesignerItem_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     // no need for a diagram link to be brought into view, since it will not be done correctly anyways
     if (IsDiagramLink)
         e.Handled = true;
     else
     {
         e.Handled = false;
         DiagramRubberbandSelector.IgnoreRubberbandSelectionOnce = true;
         //ParentCanvas.CancelRubberbandSelection();
     }
 }
 /// <summary>
 /// Attempts to bring this element into view by originating a RequestBringIntoView event.
 /// </summary>
 public void BringIntoView() 
 {
     RequestBringIntoViewEventArgs args = new RequestBringIntoViewEventArgs(this, Rect.Empty); 
     args.RoutedEvent=FrameworkElement.RequestBringIntoViewEvent; 
     RaiseEvent(args);
 } 
Beispiel #7
0
 private void renderingTab_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     CustomVisualisationExpander.IsExpanded = false;
     ItemsExpander.IsExpanded = false;
 }
Beispiel #8
0
 private void DataGrid_HandBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
Beispiel #9
0
        private void HandleBringIntoView(RequestBringIntoViewEventArgs e)
        {
            TreeViewItem parent = ParentTreeViewItem; 
            while (parent != null)
            { 
                if (!parent.IsExpanded) 
                {
                    parent.SetCurrentValueInternal(IsExpandedProperty, BooleanBoxes.TrueBox); 
                }

                parent = parent.ParentTreeViewItem;
            } 

            // See FrameworkElement.BringIntoView() comments 
            //dmitryt, bug 1126518. On new/updated elements RenderSize isn't yet computed 
            //so we need to postpone the rect computation until layout is done.
            //this is accomplished by passing Empty rect here and then asking for RenderSize 
            //in IScrollInfo when it actually executes an async MakeVisible command.
            if (e.TargetRect.IsEmpty)
            {
                FrameworkElement header = HeaderElement; 
                if (header != null)
                { 
                    e.Handled = true; 
                    header.BringIntoView();
                } 
                else
                {
                    // Header is not generated yet. Could happen if BringIntoView is called on container before layout. Try later.
                    Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new DispatcherOperationCallback(BringItemIntoView), null); 
                }
            } 
        } 
 private void TreeViewItem_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
 private void DesignerCanvas_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
Beispiel #12
0
 private void RibbonTabBlockModel_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     string ss = e.ToString();
     return;
 }
 public void BringIntoView(Rect targetRectangle)
 {
     RequestBringIntoViewEventArgs intoViewEventArgs = new RequestBringIntoViewEventArgs((DependencyObject) this, targetRectangle);
       intoViewEventArgs.RoutedEvent = FrameworkElement.RequestBringIntoViewEvent;
       this.RaiseEvent((RoutedEventArgs) intoViewEventArgs);
 }
Beispiel #14
0
 private void TabItem_RequestBringIntoView_1(object sender, RequestBringIntoViewEventArgs e)
 {
     Preset selectedPreset = presetList.SelectedItem as Preset;
     if (selectedPreset != null)
     {
         updateSectors(selectedPreset);
         updateSectorGui(selectedPreset);
     }
 }
 private void OnRequestBringIntoView( object sender, RequestBringIntoViewEventArgs e )
 {
   TableViewItemsHost.ProcessRequestBringIntoView( this,
     Orientation.Vertical,
     0.5, // Default StableScrollingProportion
     e );
 }
Beispiel #16
0
 /// <summary>
 /// Note: this needs an interactive element (Button, TextBox etc.) in the view to fire.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UserControl_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     if (this.DataContext == null) this.DataContext = new ViewModels.StringConstants();
 }
    private void OnRequestBringIntoView( object sender, RequestBringIntoViewEventArgs e )
    {
      if( e.Handled )
        return;

      Debug.Assert( this == sender );

      var dataGridControl = this.ParentDataGridControl;
      if( dataGridControl == null )
        return;

      // Prevent a BringIntoView to be requested twice when setting the focus on a cell.
      if( dataGridControl.SettingFocusOnCell )
      {
        e.Handled = true;
        return;
      }

      // Let the ScrollViewer handle this if the grid isn't virtualized.
      var scrollViewer = TreeHelper.FindParent<ScrollViewer>( this );
      if( ( scrollViewer == null ) || !scrollViewer.CanContentScroll )
        return;

      var targetVisual = e.TargetObject as Visual;
      if( targetVisual == null )
        return;

      // Let the ScrollViewer handle this if the target is the container (i.e. HeaderFooterItem).
      var container = this.GetContainerFromElement( targetVisual );
      if( ( container == null ) || ( container == targetVisual ) )
        return;

      Debug.Assert( this.Children.Contains( container ) );

      e.Handled = true;

      var targetRect = e.TargetRect;
      if( targetRect.IsEmpty )
      {
        var uiElement = TreeHelper.FindParent<UIElement>( targetVisual, true );

        // If we have a container, we surely have a UIElement.
        Debug.Assert( uiElement != null );

        targetVisual = uiElement;
        targetRect = new Rect( 0d, 0d, Math.Min( uiElement.RenderSize.Width, scrollViewer.ViewportWidth ), 0d );
      }

      var area = targetVisual.TransformToAncestor( container ).TransformBounds( targetRect );

      if( area.Left < scrollViewer.HorizontalOffset )
      {
        scrollViewer.ScrollToHorizontalOffset( area.Left );
      }
      else if( area.Right > scrollViewer.HorizontalOffset + scrollViewer.ViewportWidth )
      {
        scrollViewer.ScrollToHorizontalOffset( Math.Min( area.Left, ( area.Right - scrollViewer.ViewportWidth ) ) );
      }
    }
Beispiel #18
0
        private void setComboBindingAndHanldeUnsetValue(object sender, RequestBringIntoViewEventArgs e)
        {
            ComboBox combo = sender as ComboBox;
            DataGridComboBoxColumn column = AssignedDataGridColumn as DataGridComboBoxColumn;

            if (column.ItemsSource == null)
            {
                if (combo.ItemsSource != null)
                {
                    IList list = combo.ItemsSource.Cast<object>().ToList();

                    if (list.Count > 0 && list[0] != DependencyProperty.UnsetValue)
                    {
                        combo.RequestBringIntoView -=
                            new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);

                        list.Insert(0, DependencyProperty.UnsetValue);

                        combo.DisplayMemberPath = column.DisplayMemberPath;
                        combo.SelectedValuePath = column.SelectedValuePath;

                        combo.ItemsSource = list;
                    }
                }
            }
            else
            {
                combo.RequestBringIntoView -=
                    new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);

                IList comboList = null;
                IList columnList = null;

                if (combo.ItemsSource != null)
                {
                    comboList = combo.ItemsSource.Cast<object>().ToList();
                }

                columnList = column.ItemsSource.Cast<object>().ToList();

                if (comboList == null ||
                    (columnList.Count > 0 && columnList.Count + 1 != comboList.Count))
                {
                    columnList = column.ItemsSource.Cast<object>().ToList();
                    columnList.Insert(0, DependencyProperty.UnsetValue);

                    combo.ItemsSource = columnList;
                }

                combo.RequestBringIntoView +=
                    new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);
            }
        }
        static void tv_VerticalRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            var tv = sender as WPFControls.TreeView;
            if (tv == null)
                return;

            var scrollViewer = tv.FindVisualDescendant<WPFControls.ScrollViewer>();
            if (scrollViewer == null)
                return;

            SetCancelNextVerticalScrollEvent(tv, true);
            SetOriginalVerticalOffset(tv, scrollViewer.VerticalOffset);
        }
Beispiel #20
0
 private void TreeViewItemRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     if (_treeViewScrollViewer == null)
     {
         _treeViewScrollViewer = TheNavigationView.Navigation.Template.FindName("_tv_scrollviewer_", TheNavigationView.Navigation) as ScrollViewer;
         if (_treeViewScrollViewer != null)
             _treeViewScrollViewer.ScrollChanged += TreeViewScrollViewerScrollChanged;
     }
     _treeViewResetHorizScroll = true;
     var treeViewScrollViewer = _treeViewScrollViewer;
     if (treeViewScrollViewer != null)
     {
         _treeViewHorizScrollPos = treeViewScrollViewer.HorizontalOffset;
     }
 }
Beispiel #21
0
 /// <summary>
 /// Attempts to bring the given rectangle of this element into view by originating a RequestBringIntoView event.
 /// </summary>
 public void BringIntoView(Rect targetRectangle) 
 {
     RequestBringIntoViewEventArgs args = new RequestBringIntoViewEventArgs(this, targetRectangle); 
     args.RoutedEvent=RequestBringIntoViewEvent; 
     RaiseEvent(args);
 } 
Beispiel #22
0
        private void AppRibbon_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            int x = 0;

        }
    private void TreeViewItem_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e) {
      if (_swallowsRequestBringIntoView) {
        // This prevents the tree view for scrolling horizontally to make the
        // selected item as visibile as possible. This is useful for
        // "SearchCode", as text extracts are usually wide enough to make tree
        // view navigation annoying when they are selected.
        e.Handled = true;
        return;
      }

      // Find the scroll viewer and hook up scroll changed event handler.
      if (this._treeViewScrollViewer == null) {
        this._treeViewScrollViewer = this.FileTreeView.Template.FindName("_tv_scrollviewer_", this.FileTreeView) as ScrollViewer;
        if (_treeViewScrollViewer != null) {
          this._treeViewScrollViewer.ScrollChanged += this.TreeViewScrollViewer_ScrollChanged;
        }
      }

      // If we got a scroll viewer, remember the horizontal offset so we can
      // restore it in the scroll changed event.
      if (_treeViewScrollViewer != null) {
        this._treeViewResetHorizScroll = true;
        this._treeViewHorizScrollPos = this._treeViewScrollViewer.HorizontalOffset;
      }
      e.Handled = false;
    }
 /// <summary>
 /// stop this event from bubbling so that a scrollviewer doesn't try to BringIntoView..             
 /// </summary>
 static void SwallowBringIntoViewRequest(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
        void OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            bool? targetIsOnFrontSide = GetIsOnFrontSide(e.TargetObject);
                if (!targetIsOnFrontSide.HasValue)
                    return;

                if (targetIsOnFrontSide.Value)
                    this.BringFrontSideIntoView();
                else
                    this.BringBackSideIntoView();
        }
Beispiel #26
0
 private static void OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 { 
     if (e.TargetObject == sender)
     { 
         ((TreeViewItem)sender).HandleBringIntoView(e); 
     }
 } 
Beispiel #27
0
        /// <summary>
        /// OnRequestBringIntoView is called from the event handler ScrollViewer registers for the event.
        /// The default implementation checks to make sure the visual is a child of the IScrollInfo, and then
        /// delegates to a method there
        /// </summary>
        /// <param name="sender">The instance handling the event.</param>
        /// <param name="e">RequestBringIntoViewEventArgs indicates the element and region to scroll into view.</param>
        private static void OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
        {
            ScrollViewer sv = sender as ScrollViewer;
            Visual child = e.TargetObject as Visual;

            if (child != null)
            {
                //the event starts from the elemetn itself, so if it is an SV.BringINtoView we would
                //get an SV trying to bring into view itself  - this does not work obviously
                //so don't handle if the request is about ourselves, the event will bubble
                if (child != sv && child.IsDescendantOf(sv))
                {
                    e.Handled = true;
                    sv.MakeVisible(child, e.TargetRect);
                }
            }
            else
            {
                ContentElement contentElement = e.TargetObject as ContentElement;
                if (contentElement != null)
                {
                    // We need to find the containing Visual and the bounding box for this element.
                    IContentHost contentHost = ContentHostHelper.FindContentHost(contentElement);
                    child = contentHost as Visual;

                    if (child != null && child.IsDescendantOf(sv))
                    {
                        ReadOnlyCollection<Rect> rects = contentHost.GetRectangles(contentElement);
                        if (rects.Count > 0)
                        {
                            e.Handled = true;
                            sv.MakeVisible(child, rects[0]);
                        }
                    }
                }
            }
        }
 //Marking e.Handled = true to avoid scrolling in large workflows to bring the
 //area of a connector in the center of the view region.
 //Area covered by a connector includes the region between 0,0 of the panel and the edges of the connector.
 void OnConnectorRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
Beispiel #29
0
 /// <summary> 
 /// Handles the RequestBringIntoView routed event in the case where the element to be 
 /// brought into view is DocumentGrid itself, as is the case when the TextEditor's IP moves.
 /// In this case we use the incoming target rectangle 
 /// and ensure that rect is made visible inside of DocumentGrid.
 /// </summary>
 /// <param name="sender">The sender of this routed event, expected to be a DocumentGrid.</param>
 /// <param name="args">The RequestBringIntoView event args associated with this event.</param> 
 private static void OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs args)
 { 
     //We only handle this here if the sender and the target of this event are both the same 
     //DocumentGrid.
     DocumentGrid senderGrid = sender as DocumentGrid; 
     DocumentGrid targetGrid = args.TargetObject as DocumentGrid;
     if (senderGrid != null && targetGrid != null && senderGrid == targetGrid)
     {
         //Bring the IP into view and mark the event as handled. 
         args.Handled = true;
         targetGrid.MakeIPVisible(args.TargetRect); 
     } 
     else
     { 
         args.Handled = false;
     }
 }
 private void Popup_ScrollViewer_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
 {
     e.Handled = true;
 }
    private void OnRequestBringIntoView( object sender, RequestBringIntoViewEventArgs e )
    {
      // Only perform this if we are virtualizing.  
      // If not, the ScrollViewer will take care of bringing the item into view.
      if( ( this.ScrollOwner == null ) || ( !this.ScrollOwner.CanContentScroll ) )
        return;

      // Only perform this if the StableScrolling feature is enabled.
      if( !this.StableScrollingEnabled )
        return;

      // If we are explicitly setting the focus on a cell, we don't want to bring it into view.
      // A bringIntoView would cause the HorizontalOffset to change is not a wanted behavior.
      // Therefore, flag the Request as handled and do nothing.
      DataGridContext dataGridContext = DataGridControl.GetDataGridContext( this );

      DataGridControl dataGridControl = ( dataGridContext != null )
        ? dataGridContext.DataGridControl
        : null;

      if( ( dataGridControl != null ) && ( dataGridControl.SettingFocusOnCell ) )
      {
        e.Handled = true;
        return;
      }

      // Only perform this if the object is NOT a Cell and was not passed a specific rectangle.
      if( ( e.TargetObject is Cell ) || ( e.TargetRect != Rect.Empty ) )
        return;

      // Before performing calculations, ensure that the element is a UIElement.
      FrameworkElement target = e.TargetObject as FrameworkElement;

      if( ( target == null ) || ( target.IsDescendantOf( this ) == false ) )
        return;

      Orientation orientation = this.Orientation;

      //mark the routed event as handled, since under even the worst circumstances, a new event will be raised.
      e.Handled = true;

      double acceptableThreshold;
      double actualVisibleValue;

      GeneralTransform itemToPanel = target.TransformToAncestor( this );
      Point itemOrigin = itemToPanel.Transform( new Point( 0, 0 ) );

      //Calculate the VisibleWidth/Height of the object within the Viewport.
      if( orientation == Orientation.Vertical )
      {
        acceptableThreshold = this.ViewportWidth * this.StableScrollingProportion;

        //item offset is positive in the viewport.
        if( itemOrigin.X >= 0 )
        {
          //if the item is totally visible
          if( target.ActualWidth + itemOrigin.X <= this.ViewportWidth )
          {
            //this will force the function to "cancel" the BringIntoView
            actualVisibleValue = this.ViewportWidth;
          }
          else
          {
            //item is not totally visible, calculate how much place it occupies in the viewport.
            actualVisibleValue = this.ViewportWidth - itemOrigin.X;
          }
        }
        //item offset is negative
        else
        {
          actualVisibleValue = target.ActualWidth - itemOrigin.X;
          if( actualVisibleValue > this.ViewportWidth )
          {
            //limit the value of actualVisibleValue to the Viewport size (to prevent eventual bugs [even if nothing is visible on the horizon for this])
            actualVisibleValue = this.ViewportWidth;
          }
        }
      }
      else
      {
        acceptableThreshold = this.ViewportHeight * this.StableScrollingProportion;

        //item offset is positive in the viewport.
        if( itemOrigin.Y >= 0 )
        {
          //if the item is totally visible
          if( target.ActualHeight + itemOrigin.Y <= this.ViewportHeight )
          {
            //this will force the function to "cancel" the BringIntoView
            actualVisibleValue = this.ViewportHeight;
          }
          else
          {
            //item is not totally visible, calculate how much place it occupies in the viewport.
            actualVisibleValue = this.ViewportHeight - itemOrigin.Y;
          }
        }
        //item offset is negative
        else
        {
          actualVisibleValue = target.ActualHeight - itemOrigin.Y;
          if( actualVisibleValue > this.ViewportHeight )
          {
            //limit the value of actualVisibleValue to the Viewport size (to prevent eventual bugs [even if nothing is visible on the horizon for this])
            actualVisibleValue = this.ViewportHeight;
          }
        }
      }

      bool needBringIntoView = false;
      Rect newRect = new Rect( 0, 0, target.ActualWidth, target.ActualHeight );

      //After the proportion visible from the object is calculated, compare with threshold
      if( actualVisibleValue < acceptableThreshold )
      {
        needBringIntoView = true;
        //the required threshold is not visible, modify the bounds of the rectangle 
        //to bring at Max, the desired threshold.
        if( orientation == Orientation.Vertical )
        {
          if( itemOrigin.X >= 0 )
          {
            newRect.Width = Math.Min( acceptableThreshold, target.ActualWidth );
          }
          else
          {
            newRect.X = target.ActualWidth - acceptableThreshold;
            if( newRect.X < 0 )
            {
              newRect.X = 0;
            }
          }
        }
        else
        {
          if( itemOrigin.Y >= 0 )
          {
            newRect.Height = Math.Min( acceptableThreshold, target.ActualHeight );
          }
          else
          {
            newRect.Y = target.ActualHeight - acceptableThreshold;
            if( newRect.Y < 0 )
            {
              newRect.Y = 0;
            }
          }
        }//end else orientation is Horizontal
      } // end if actuallyVisible < acceptable threshold
      else
      {
        //Determine if the item is totally or partially visible on the main scrolling axis.             
        if( orientation == Orientation.Vertical )
        {
          //If the Offset is negative, then it's sure its not totally visible
          if( itemOrigin.Y < 0 )
          {
            needBringIntoView = true;
          }
          else if( ( ( itemOrigin.Y + target.DesiredSize.Height ) > this.RenderSize.Height ) && ( target.DesiredSize.Height < this.RenderSize.Height ) )
          {
            needBringIntoView = true;
          }
        }
        else
        {
          //If the Offset is negative, then it's sure its not totally visible
          if( itemOrigin.X < 0 )
          {
            needBringIntoView = true;
          }
          else if( ( ( itemOrigin.X + target.DesiredSize.Width ) > this.RenderSize.Width ) && ( target.DesiredSize.Width < this.RenderSize.Width ) )
          {
            needBringIntoView = true;
          }
        }

        //if the item need to be scrolled in view
        if( needBringIntoView == true )
        {
          //the goal is to preserve the actual opposed axis scrolling
          if( orientation == Orientation.Vertical )
          {
            //calculate the starting point of the rectangle to view.
            newRect.X = itemOrigin.X * -1;
            if( newRect.X < 0 )
            {
              newRect.X = 0;
            }

            //if the item to be brough into view is part of the elements in a TableView that do no scroll
            if( ( dataGridControl != null )
              && ( dataGridControl.GetView() is TableView )
              && ( this.ComputedCanScrollHorizontally( target ) == false ) )
            {
              //then do not change the HorizontalOffset... set the same on the object as previously availlable.
              newRect.X = this.HorizontalOffset;
            }


            //if the rectangle of the object goes beyond the Viewport
            if( newRect.Right > this.ViewportWidth )
            {
              //subtract what goes beyond!
              newRect.Width = newRect.Width - ( newRect.Width - this.ViewportWidth ) - Math.Max( itemOrigin.X, 0 );
            }
          }
          else
          {
            //calculate the staring point if the rectangle to view.
            newRect.Y = itemOrigin.Y * -1;
            if( newRect.Y < 0 )
            {
              newRect.Y = 0;
            }

            //if the rectangle of the object goes beyond the Viewport
            if( newRect.Bottom > this.ViewportHeight )
            {
              //subtract what goes beyond!
              newRect.Height = newRect.Height - ( newRect.Height - this.ViewportHeight ) - Math.Max( itemOrigin.Y, 0 );
            }
          }
        } // end if needBringIntoView == true
      } // end else 


      //Call a new BringIntoView on the target element
      if( needBringIntoView == true )
        target.BringIntoView( newRect );
    }