Export (0) Print
Expand All

InkCanvas.GetSelectedElements Method

Retrieves the FrameworkElement objects that are selected in the InkCanvas.

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

public ReadOnlyCollection<UIElement> GetSelectedElements ()
public ReadOnlyCollection<UIElement> GetSelectedElements ()
public function GetSelectedElements () : ReadOnlyCollection<UIElement>
You cannot use methods in XAML.

Return Value

Array of FrameworkElement objects.

An InkCanvas can contain both Stroke objects, which are created in response to user stylus input, and FrameworkElement objects, such as Image and Button objects. Using this method will return only FrameworkElement objects, not Stroke objects. To retrieve selected Stroke objects, call the GetSelectedStrokes method.

Both Stroke and FrameworkElement objects can be selected by user selection while the EditingMode of InkCanvas is set to EditingMode, or in code by calling the Select method.

The following example doubles the height and width of each selected element on an InkCanvas.

ScaleTransform scaler = new ScaleTransform(2,2);

ReadOnlyCollection<UIElement> selectedElements = inkCanvas1.GetSelectedElements();

foreach (UIElement element in selectedElements)
{
    element.RenderTransform = scaler;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft