Export (0) Print
Expand All

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)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public event InkCanvasSelectionChangingEventHandler SelectionChanging
<object SelectionChanging="InkCanvasSelectionChangingEventHandler" .../>

The SelectionChanging event is raised when strokes and/or elements are selected by the user - but before the change is applied.

The SelectionChanging event is processed when the InkCanvasSelectionChangingEventHandler receives an InkCanvasSelectionChangingEventArgs object. InkCanvasSelectionChangingEventArgs provides methods for accessing FrameworkElement and StrokeCollection objects after they are selected by the user.

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.

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;
        }

    }
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft