InkCanvas.GetSelectedElements Método

Definição

Recupera os objetos FrameworkElement selecionados no InkCanvas.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Windows::UIElement ^> ^ GetSelectedElements();
public System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.UIElement> GetSelectedElements ();
member this.GetSelectedElements : unit -> System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.UIElement>
Public Function GetSelectedElements () As ReadOnlyCollection(Of UIElement)

Retornos

ReadOnlyCollection<UIElement>

Matriz de objetos FrameworkElement.

Exemplos

O exemplo a seguir dobra a altura e a largura de cada elemento selecionado em um InkCanvas.

ScaleTransform scaler = new ScaleTransform(2,2);

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

foreach (UIElement element in selectedElements)
{
    element.RenderTransform = scaler;
}
Dim scaler As New ScaleTransform(2, 2)

Dim selectedElements As ReadOnlyCollection(Of UIElement) = inkCanvas1.GetSelectedElements()

Dim element As UIElement
For Each element In selectedElements
    element.RenderTransform = scaler
Next element

Comentários

Esse método retorna apenas FrameworkElement objetos, não Stroke objetos.

Para recuperar objetos selecionados Stroke , chame o GetSelectedStrokes método.

Se o EditingMode de InkCanvas for definido como EditingMode, os usuários poderão selecionar Stroke objetos e FrameworkElement objetos. Como alternativa, ambos os tipos de objetos podem ser selecionados usando o código: basta chamar o Select método.

Aplica-se a

Confira também