InkCanvas.SelectionChanging InkCanvas.SelectionChanging InkCanvas.SelectionChanging InkCanvas.SelectionChanging Event

Definición

Se produce cuando se selecciona un nuevo conjunto de trazos de entrada de lápiz o elementos.Occurs when a new set of ink strokes and/or elements is being selected.

public:
 event System::Windows::Controls::InkCanvasSelectionChangingEventHandler ^ SelectionChanging;
public event System.Windows.Controls.InkCanvasSelectionChangingEventHandler SelectionChanging;
member this.SelectionChanging : System.Windows.Controls.InkCanvasSelectionChangingEventHandler 
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler 

Ejemplos

El ejemplo siguiente hace que los trazos seleccionados royal azul.The following example makes selected strokes royal blue.

void inkCanvas1_SelectionChanging(object sender, InkCanvasSelectionChangingEventArgs e)
{
    StrokeCollection selectedStrokes = e.GetSelectedStrokes();
    
    foreach (Stroke aStroke in inkCanvas1.Strokes)
    {
        if (selectedStrokes.Contains(aStroke))
        {
            aStroke.DrawingAttributes.Color = Colors.RoyalBlue;
        }
        else
        {
            aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color;
        }

    }
}
Private Sub inkCanvas1_SelectionChanging(ByVal sender As Object, _
                                 ByVal e As InkCanvasSelectionChangingEventArgs)

    Dim selectedStrokes As StrokeCollection = e.GetSelectedStrokes()

    Dim aStroke As Stroke
    For Each aStroke In inkCanvas1.Strokes
        If selectedStrokes.Contains(aStroke) Then
            aStroke.DrawingAttributes.Color = Colors.RoyalBlue
        Else
            aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color
        End If
    Next aStroke

End Sub 'inkCanvas1_SelectionChanging

Comentarios

El SelectionChanging evento se produce cuando se seleccionan los trazos o elementos por el usuario, pero antes de aplicar el cambio.The SelectionChanging event is raised when strokes and/or elements are selected by the user - but before the change is applied.

El SelectionChanging se procesa el evento cuando la InkCanvasSelectionChangingEventHandler recibe un InkCanvasSelectionChangingEventArgs objeto.The SelectionChanging event is processed when the InkCanvasSelectionChangingEventHandler receives an InkCanvasSelectionChangingEventArgs object. InkCanvasSelectionChangingEventArgs Proporciona métodos para tener acceso a FrameworkElement y StrokeCollection objetos una vez que se seleccionan por el usuario.InkCanvasSelectionChangingEventArgs provides methods for accessing FrameworkElement and StrokeCollection objects after they are selected by the user.

Después de aplicar el cambio, el SelectionChanged provoca el evento.After the change is applied, the SelectionChanged event is raised.

Nota

El SelectionChanging evento no se produce cuando se eliminan los trazos seleccionados o cuando el ActiveEditingMode los cambios de propiedad.The SelectionChanging event does not occur when the selected strokes are deleted or when the ActiveEditingMode property changes.

Se aplica a

Consulte también: