InkCanvas.SelectionChanging Event
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 Custom Event SelectionChanging As InkCanvasSelectionChangingEventHandler
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler
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
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.
Note
The SelectionChanging event does not occur when the selected strokes are deleted or when the ActiveEditingMode property changes.
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: