Edit

Share via


InfiniteCanvas Class

Definition

InfiniteCanvas is a canvas that supports Ink, Text, Format Text, Zoom in/out, Redo, Undo, Export canvas data, Import canvas data.

[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxTools", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxColorPicker", Type=typeof(Windows.UI.Xaml.Controls.ColorPicker))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxFontSizeTextBox", Type=typeof(Windows.UI.Xaml.Controls.TextBox))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxItalicButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxBoldButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="DrawingSurfaceRenderer", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasVirtualDrawingSurface))]
[Windows.UI.Xaml.TemplatePart(Name="MainContainer", Type=typeof(Windows.UI.Xaml.Controls.Canvas))]
[Windows.UI.Xaml.TemplatePart(Name="InfiniteCanvasScrollViewer", Type=typeof(Windows.UI.Xaml.Controls.ScrollViewer))]
[Windows.UI.Xaml.TemplatePart(Name="EraseAllButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBox", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasTextBox))]
[Windows.UI.Xaml.TemplatePart(Name="EnableTextButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToolButton))]
[Windows.UI.Xaml.TemplatePart(Name="EnableTouchInkingButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="InkCanvasToolBar", Type=typeof(Windows.UI.Xaml.Controls.InkToolbar))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasToolbarContainer", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))]
[Windows.UI.Xaml.TemplatePart(Name="DrawingInkCanvas", Type=typeof(Windows.UI.Xaml.Controls.InkCanvas))]
[Windows.UI.Xaml.TemplatePart(Name="UndoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="RedoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="FontColorIcon", Type=typeof(Windows.UI.Xaml.Controls.FontIcon))]
public class InfiniteCanvas : Windows.UI.Xaml.Controls.Control
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxTools", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxColorPicker", Type=typeof(Windows.UI.Xaml.Controls.ColorPicker))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxItalicButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxBoldButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="DrawingSurfaceRenderer", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasVirtualDrawingSurface))]
[Windows.UI.Xaml.TemplatePart(Name="MainContainer", Type=typeof(Windows.UI.Xaml.Controls.Canvas))]
[Windows.UI.Xaml.TemplatePart(Name="InfiniteCanvasScrollViewer", Type=typeof(Windows.UI.Xaml.Controls.ScrollViewer))]
[Windows.UI.Xaml.TemplatePart(Name="EraseAllButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasTextBox", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasTextBox))]
[Windows.UI.Xaml.TemplatePart(Name="EnableTextButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToolButton))]
[Windows.UI.Xaml.TemplatePart(Name="EnableTouchInkingButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToggleButton))]
[Windows.UI.Xaml.TemplatePart(Name="InkCanvasToolBar", Type=typeof(Windows.UI.Xaml.Controls.InkToolbar))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasToolbarContainer", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))]
[Windows.UI.Xaml.TemplatePart(Name="DrawingInkCanvas", Type=typeof(Windows.UI.Xaml.Controls.InkCanvas))]
[Windows.UI.Xaml.TemplatePart(Name="UndoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="RedoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))]
[Windows.UI.Xaml.TemplatePart(Name="FontColorIcon", Type=typeof(Windows.UI.Xaml.Controls.FontIcon))]
[Windows.UI.Xaml.TemplatePart(Name="CanvasComboBoxFontSizeTextBox", Type=typeof(Windows.UI.Xaml.Controls.TextBox))]
public class InfiniteCanvas : Windows.UI.Xaml.Controls.Control
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxTools", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxColorPicker", Type=typeof(Windows.UI.Xaml.Controls.ColorPicker))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxFontSizeTextBox", Type=typeof(Windows.UI.Xaml.Controls.TextBox))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxItalicButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxBoldButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="DrawingSurfaceRenderer", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasVirtualDrawingSurface))>]
[<Windows.UI.Xaml.TemplatePart(Name="MainContainer", Type=typeof(Windows.UI.Xaml.Controls.Canvas))>]
[<Windows.UI.Xaml.TemplatePart(Name="InfiniteCanvasScrollViewer", Type=typeof(Windows.UI.Xaml.Controls.ScrollViewer))>]
[<Windows.UI.Xaml.TemplatePart(Name="EraseAllButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBox", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasTextBox))>]
[<Windows.UI.Xaml.TemplatePart(Name="EnableTextButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToolButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="EnableTouchInkingButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="InkCanvasToolBar", Type=typeof(Windows.UI.Xaml.Controls.InkToolbar))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasToolbarContainer", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))>]
[<Windows.UI.Xaml.TemplatePart(Name="DrawingInkCanvas", Type=typeof(Windows.UI.Xaml.Controls.InkCanvas))>]
[<Windows.UI.Xaml.TemplatePart(Name="UndoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="RedoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="FontColorIcon", Type=typeof(Windows.UI.Xaml.Controls.FontIcon))>]
type InfiniteCanvas = class
    inherit Control
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxTools", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxColorPicker", Type=typeof(Windows.UI.Xaml.Controls.ColorPicker))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxItalicButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBoxBoldButton", Type=typeof(Windows.UI.Xaml.Controls.Primitives.ToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="DrawingSurfaceRenderer", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasVirtualDrawingSurface))>]
[<Windows.UI.Xaml.TemplatePart(Name="MainContainer", Type=typeof(Windows.UI.Xaml.Controls.Canvas))>]
[<Windows.UI.Xaml.TemplatePart(Name="InfiniteCanvasScrollViewer", Type=typeof(Windows.UI.Xaml.Controls.ScrollViewer))>]
[<Windows.UI.Xaml.TemplatePart(Name="EraseAllButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasTextBox", Type=typeof(Microsoft.Toolkit.Uwp.UI.Controls.InfiniteCanvasTextBox))>]
[<Windows.UI.Xaml.TemplatePart(Name="EnableTextButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToolButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="EnableTouchInkingButton", Type=typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToggleButton))>]
[<Windows.UI.Xaml.TemplatePart(Name="InkCanvasToolBar", Type=typeof(Windows.UI.Xaml.Controls.InkToolbar))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasToolbarContainer", Type=typeof(Windows.UI.Xaml.Controls.StackPanel))>]
[<Windows.UI.Xaml.TemplatePart(Name="DrawingInkCanvas", Type=typeof(Windows.UI.Xaml.Controls.InkCanvas))>]
[<Windows.UI.Xaml.TemplatePart(Name="UndoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="RedoButton", Type=typeof(Windows.UI.Xaml.Controls.Button))>]
[<Windows.UI.Xaml.TemplatePart(Name="FontColorIcon", Type=typeof(Windows.UI.Xaml.Controls.FontIcon))>]
[<Windows.UI.Xaml.TemplatePart(Name="CanvasComboBoxFontSizeTextBox", Type=typeof(Windows.UI.Xaml.Controls.TextBox))>]
type InfiniteCanvas = class
    inherit Control
Public Class InfiniteCanvas
Inherits Control
Inheritance
Windows.UI.Xaml.Controls.Control
InfiniteCanvas
Attributes
Windows.UI.Xaml.TemplatePartAttribute

Constructors

InfiniteCanvas()

Initializes a new instance of the InfiniteCanvas class.

Fields

CanvasHeightProperty

Identifies the CanvasHeight dependency property.

CanvasWidthProperty

Identifies the CanvasWidth dependency property.

IsToolbarVisibleProperty

Identifies the IsToolbarVisible dependency property.

MaxZoomFactorProperty

Identifies the MaxZoomFactor dependency property.

MinZoomFactorProperty

Identifies the MinZoomFactor dependency property.

Properties

CanvasHeight

Gets or sets the height of the canvas, default value is the max value 2097152

CanvasWidth

Gets or sets the width of the canvas, default value is the max value 2097152

IsToolbarVisible

Gets or sets a value indicating whether the toolbar is visible or not.

MaxZoomFactor

Gets or sets the MaxZoomFactor for the canvas, range between 1 to 10 and the default value is 4

MinZoomFactor

Gets or sets the MinZoomFactor for the canvas, range between .1 to 1 the default value is .25

Methods

ExportAsJson()

Export the InfinitCanvas as json string.

ExportInkStrokes()

Export the InfiniteCanvas ink strokes.

ExportText()

Export the InfiniteCanvas raw text.

ImportFromJson(String)

Import InfiniteCanvas from json string and render the new canvas, this function will empty the Redo/Undo queue.

OnApplyTemplate() Windows.UI.Xaml.Controls.Control.OnApplyTemplate
OnKeyDown(KeyRoutedEventArgs) Windows.UI.Xaml.Controls.Control.OnKeyDown(Windows.UI.Xaml.Input.KeyRoutedEventArgs)
Redo()

Redo the last action.

SaveBitmapAsync(IRandomAccessStream, BitmapFileFormat)

This method exports the max possible view of the InfiniteCanvas drawings as offScreen drawings that can be converted to image. Max is calculated using CanvasDevice.MaximumBitmapSizeInPixels

Undo()

Undo the last action.

Events

ReRenderCompleted

This event triggered after each render happened because of any change in the canvas elements.

Applies to