Modifier

Partager via


InkToolbar control for Windows Forms and WPF

The InkToolbar control provides an interface to manage an InkCanvas for Windows Ink-based user interaction in your Windows Forms or WPF desktop application. This is one of several wrapped Universal Windows Platform controls that are available for Windows Forms and WPF applications as part of a feature called XAML Islands. For more information, see UWP controls in desktop applications (XAML Islands).

InkToolbar example

Note

If you have feedback about this control, create a new issue in the microsoft-ui-xaml repo and leave your comments there.

About InkToolbar control

This control wraps an instance of the UWP Windows.UI.Xaml.Controls.InkToolbar control. The WPF version of this control is located in the Microsoft.Toolkit.Wpf.UI.Controls namespace. The Windows Forms version is located in the Microsoft.Toolkit.Forms.UI.Controls namespace. You can find additional related types (such as enums and event args classes) in the Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT namespace.

For a walkthrough that demonstrates how to host an InkToolbar wrapped control in a WPF app, see Host a standard UWP control in a WPF app using XAML Islands.

Prerequisites

Before you can use this control, you must follow these instructions to configure your project to support XAML Islands.

Known issues and limitations

See our list of known issues for WPF and Windows Forms controls in the Windows Community Toolkit repo.

Syntax

<Window x:Class="TestSample.MainWindow" ...
  xmlns:controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
...>


<controls:InkToolbar  DockPanel.Dock="Top" x:Name="inkToolbar" Grid.Row="0" TargetInkCanvas="{x:Reference Name=inkCanvas}"    
      Initialized="inkToolbar_Initialized" ActiveToolChanged="inkToolbar_ActiveToolChanged"
      InkDrawingAttributesChanged="inkToolbar_InkDrawingAttributesChanged"
      IsStencilButtonCheckedChanged="inkToolbar_IsStencilButtonCheckedChanged"  >
    <controls:InkToolbarCustomToolButton x:Name="toolButtonLasso" />
</controls:InkToolbar>

Properties

The following properties wrap corresponding properties of the wrapped UWP Windows.UI.Xaml.Controls.InkToolbar object. See the links in this table for more information about each property.

Property Type Description
ActiveTool WindowsXamlHostBaseExt Wraps the ActiveTool property.
ActiveToolProperty DependencyProperty Dependency property for the ActiveTool property.
ButtonFlyoutPlacement InkToolbarButtonFlyoutPlacement Wraps the ButtonFlyoutPlacement property.
ButtonFlyoutPlacementProperty DependencyProperty Dependency property for the ButtonFlyoutPlacement property.
Children ObservableCollection<DependencyObject> Wraps the Children property.
InitialControls InkToolbarInitialControls Wraps the InitialControls property.
InitialControlsProperty DependencyProperty Dependency property for the InitialControls property.
InkDrawingAttributes InkDrawingAttributes Wraps the InkDrawingAttributes property.
InkDrawingAttributesProperty DependencyProperty Dependency property for the InkDrawingAttributes property.
IsRulerButtonChecked bool Wraps the IsRulerButtonChecked property.
IsRulerButtonCheckedProperty DependencyProperty Dependency property for the IsRulerButtonChecked property.
IsStencilButtonChecked bool Wraps the IsStencilButtonChecked property.
IsStencilButtonCheckedProperty DependencyProperty Dependency property for the IsStencilButtonChecked property.
Orientation Orientation Wraps the Orientation property.
OrientationProperty DependencyProperty Dependency property for the Orientation property.
TargetInkCanvas InkCanvas Wraps the TargetInkCanvas property.
TargetInkCanvasProperty DependencyProperty Dependency property for the TargetInkCanvas property.

Events

The following events wrap corresponding events of the wrapped UWP Windows.UI.Xaml.Controls.InkToolbar object. See the links in this table for more information about each property.

Event Description
ActiveToolChanged Wraps the ActiveToolChanged event.
EraseAllClicked Wraps the EraseAllClicked event.
IsRulerButtonCheckedChanged Wraps the IsRulerButtonCheckedChanged event.
IsStencilButtonCheckedChanged Wraps the IsStencilButtonCheckedChanged event.

Requirements

Device family .NET 4.6.2, Windows 10 (introduced v10.0.17709.0)
Namespace Windows Forms: Microsoft.Toolkit.Forms.UI.Controls
WPF: Microsoft.Toolkit.Wpf.UI.Controls
NuGet package Windows Forms: Microsoft.Toolkit.Forms.UI.Controls
WPF: Microsoft.Toolkit.Wpf.UI.Controls

API