Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

InkCanvas.SelectionChanging Event

Occurs when a new set of ink strokes and/or elements is being selected.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

'Declaration
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler
'Usage
Dim instance As InkCanvas
Dim handler As InkCanvasSelectionChangingEventHandler

AddHandler instance.SelectionChanging, handler

/** @event */
public void add_SelectionChanging (InkCanvasSelectionChangingEventHandler value)

/** @event */
public void remove_SelectionChanging (InkCanvasSelectionChangingEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
<object SelectionChanging="InkCanvasSelectionChangingEventHandler" .../>

The SelectionChanging event is raised when a new selection of strokes and/or elements is made by the user and before the change is applied.

The SelectionChanging event is processed through the InkCanvasSelectionChangingEventHandler that receives an InkCanvasSelectionChangingEventArgs object. InkCanvasSelectionChangingEventArgs provides methods for accessing the user's selection of FrameworkElement and StrokeCollection objects.

After the change is applied, the SelectionChanged event is raised.

NoteNote:

The SelectionChanging event does not occur when the selected strokes are deleted or when the ActiveEditingMode property changes.

The following example makes selected strokes royal blue.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2017 Microsoft