Compartir a través de


TextWordNode.Data Property

Gets and sets application-defined data for the TextWordNode object.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace:  https://schemas.microsoft.com/winfx/2006/xaml/presentation

Syntax

'Declaration
Public Property Data As Object
'Usage
Dim instance As TextWordNode
Dim value As Object

value = instance.Data

instance.Data = value
public Object Data { get; set; }
public:
property Object^ Data {
    Object^ get ();
    void set (Object^ value);
}
/** @property */
public Object get_Data ()

/** @property */
public void set_Data (Object value)
public function get Data () : Object

public function set Data (value : Object)
Not applicable.

Property Value

The application-defined data for the TextWordNode object.

Remarks

Use this to add your own data to the TextWordNode object.

Example

The following example adds a TextWordNode object to an InkAnalyzer, theInkAnalyzer, for a TextBox control, theTextBox. It sets the Data property of the TextWordNode object to be the Text property of the TextBox.

' Add nodes to hold the TextWordNode
Dim writingRegion As WritingRegionNode = _
    CType(theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.WritingRegion), _
    WritingRegionNode)

Dim paragraph As ParagraphNode = _
    CType(writingRegion.CreateSubNode(ContextNodeType.Paragraph), _
    ParagraphNode)

Dim line As LineNode = _
    CType(paragraph.CreateSubNode(ContextNodeType.Line), LineNode)

' Create node for the word
Dim textWord As TextWordNode = _
    CType(line.CreateSubNode(ContextNodeType.TextWord), TextWordNode)

' Set location
Dim textTop As Double = InkCanvas.GetTop(theTextBox)
Dim textLeft As Double = InkCanvas.GetLeft(theTextBox)

Dim rectLocation As New Rect(textLeft, textTop, theTextBox.Width, theTextBox.Height)
textWord.SetLocation(New AnalysisRegion(rectLocation))

' Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text
// Add nodes to hold the TextWordNode
WritingRegionNode writingRegion = (WritingRegionNode)
    theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.WritingRegion);
ParagraphNode paragraph = (ParagraphNode)
    writingRegion.CreateSubNode(ContextNodeType.Paragraph);
LineNode line = (LineNode)
    paragraph.CreateSubNode(ContextNodeType.Line);

// Create node for the word
TextWordNode textWord = (TextWordNode)
    line.CreateSubNode(ContextNodeType.TextWord);


// Set location
double textTop = InkCanvas.GetTop(theTextBox);
double textLeft = InkCanvas.GetLeft(theTextBox);

Rect rectLocation = new Rect(textLeft, textTop, theTextBox.Width, theTextBox.Height);
textWord.SetLocation(new AnalysisRegion(rectLocation));

// Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text;

Platforms

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

TextWordNode Class
TextWordNode Members
System.Windows.Ink Namespace