InkCanvas.EditingMode Property

 

Gets or sets the user editing mode used by an active pointing device.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Property EditingMode As InkCanvasEditingMode

Property Value

Type: System.Windows.Controls.InkCanvasEditingMode

The editing mode used when a pointing device (such as a tablet pen or mouse) is active.

The default EditingMode is Ink. Changing the EditingMode clears any existing selections.

The EditingMode specifies the mode of the pointing device as it interacts with the InkCanvas. EditingModeInverted is used by some digitizers when the "eraser end" of the stylus contacts the digitizer.

Identifier field

EditingModeProperty

Metadata properties set to true

None

The following example creates an application that uses the various types of editing modes on an InkCanvas.

Class Window1
    Inherits Window

    Private inkEditingMode As RadioButton
    Private selectEditingMode As RadioButton
    Private eraseByStrokeEditingMode As RadioButton
    Private eraseByPointEditingMode As RadioButton

    Private inkCanvas1 As InkCanvas
    Private stackPanel1 As StackPanel
    Private root As DockPanel

    Public Sub New() 
        InitializeComponent()

    End Sub 'NewNew


    Private Sub WindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 

        root = New DockPanel()
        Me.Content = root

        stackPanel1 = New StackPanel()
        root.Children.Add(stackPanel1)

        inkEditingMode = New RadioButton()
        inkEditingMode.Content = "Ink"
        stackPanel1.Children.Add(inkEditingMode)
        AddHandler inkEditingMode.Click, AddressOf inkEditingMode_Click
        inkEditingMode.IsChecked = True

        selectEditingMode = New RadioButton()
        selectEditingMode.Content = "Select"
        stackPanel1.Children.Add(selectEditingMode)
        AddHandler selectEditingMode.Click, AddressOf selectEditingMode_Click

        eraseByStrokeEditingMode = New RadioButton()
        eraseByStrokeEditingMode.Content = "Erase by Stroke"
        stackPanel1.Children.Add(eraseByStrokeEditingMode)
        AddHandler eraseByStrokeEditingMode.Click, AddressOf eraseByStrokeEditingMode_Click

        eraseByPointEditingMode = New RadioButton()
        eraseByPointEditingMode.Content = "Erase by Point"
        stackPanel1.Children.Add(eraseByPointEditingMode)
        AddHandler eraseByPointEditingMode.Click, AddressOf eraseByPointEditingMode_Click

        inkCanvas1 = New InkCanvas()
        root.Children.Add(inkCanvas1)

    End Sub 'WindowLoaded


    Private Sub eraseByPointEditingMode_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

        inkCanvas1.EditingMode = InkCanvasEditingMode.EraseByPoint

    End Sub 'eraseByPointEditingMode_Click


    Private Sub eraseByStrokeEditingMode_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

        inkCanvas1.EditingMode = InkCanvasEditingMode.EraseByStroke

    End Sub 'eraseByStrokeEditingMode_Click


    Private Sub selectEditingMode_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

        inkCanvas1.EditingMode = InkCanvasEditingMode.Select

    End Sub 'selectEditingMode_Click


    Private Sub inkEditingMode_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

        inkCanvas1.EditingMode = InkCanvasEditingMode.Ink

    End Sub 'inkEditingMode_Click
End Class 'Window1

.NET Framework
Available since 3.0
Return to top
Show: