次の方法で共有


ContextNode.PartiallyPopulated プロパティ

ContextNode オブジェクトが一部だけ書き込まれているか、すべて書き込まれているかを示す値を取得または設定します。

名前空間 :  System.Windows.Ink
アセンブリ :  IAWinFX (IAWinFX.dll 内)

構文

'宣言
Public Property PartiallyPopulated As Boolean
'使用
Dim instance As ContextNode
Dim value As Boolean

value = instance.PartiallyPopulated

instance.PartiallyPopulated = value
public bool PartiallyPopulated { get; set; }
public:
property bool PartiallyPopulated {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_PartiallyPopulated()
/** @property */
public  void set_PartiallyPopulated(boolean value)
public function get PartiallyPopulated () : boolean
public function set PartiallyPopulated (value : boolean)

プロパティ値

型 : System.Boolean
データ プロキシ処理中、ContextNode に部分的なデータが含まれる場合は true。すべてのデータが追加されている場合は false。

解説

ツリーに関するすべての情報が使用可能になる前に ContextNode オブジェクトがコンテキスト ノード ツリーで作成された場合は、データ プロキシにこのプロパティを使用します。このプロパティは、データの完全な書き込みが行われたかどうかを示します。

次の例では、[System.Windows.Controls.TreeView] をドキュメント モデルとして使用して、InkAnalyzer のコンテキスト ノード ツリーの格納と読み込みにデータ プロキシを使用する方法を示す、サンプル コードの PopulateNode というメソッドを示します。各 TreeViewItem オブジェクトの [System.Windows.FrameworkElement.Tag] プロパティが DocumentNodeData オブジェクトに設定されている場合、DocumentNodeData クラスは ContextNode データをドキュメント モデルに格納します。

PopulateNode メソッドは、ストローク、プロパティ データ、注釈の種類、子ノード、およびリンクを追加することにより、ContextNode オブジェクトと InkAnalyzer オブジェクトを使用してコンテキスト ノードに完全に書き込みます。データは、対応する TreeViewItem から取得される DocumentNodeData オブジェクトにより生成されます。

  • this[analyzerNode.Id] は、GuidTreeViewItem に対応付けるドキュメント モデルのクラスのインデクサです

  • AddLinksToAnalyer は、ContextNode にリンクを追加するドキュメント モデル クラス上のメソッドです。

ノードに完全に書き込みが行われたら、PartiallyPopulated プロパティが false に設定されます。

Sub PopulateNode(ByVal analyzerNode As ContextNode, ByVal theInkAnalyzer As InkAnalyzer)  Implements IDocumentModel.PopulateNode

    System.Diagnostics.Debug.WriteLine(String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", analyzerNode.ToString(), GetRecognizedString(analyzerNode)))
    System.Diagnostics.Debug.Indent()

    ' Get the document node associated with the analyzer node.
    Dim documentNode As TreeViewItem = Me(analyzerNode.Id)
    If documentNode Is Nothing Then
        Throw New ApplicationException("The requested node does not exist in the document model.")
    End If

    ' Get the data associated with the node.
    Dim nodeData As DocumentNodeData = documentNode.Tag '

    ' Copy any application specific data associated with the node to the
    ' partially populated ContextNode.
    For Each identifier As Guid In nodeData.GetPropertyDataIds()
        analyzerNode.AddPropertyData(identifier, nodeData.GetPropertyData(identifier))
    Next identifier

    ' Check if the partially populated ContextNode is an ink leaf node.
    If nodeData.IsInkLeafNode Then
        ' Add the strokes to the context node.
        analyzerNode.SetStrokes(nodeData.Strokes)
    Else
        ' Add each child subnode as a partially populated ContextNode.
        Dim documentSubNode As TreeViewItem
        For Each documentSubNode In  documentNode.Items
            ' Get the DocumentNode data for the 
            Dim subNodeData As DocumentNodeData = documentSubNode.Tag '

            If analyzerNode.SubNodes.IndexOf(nodeData.Id) <> -1 Then
                analyzerNode.CreatePartiallyPopulatedSubNode( _
                subNodeData.Type, subNodeData.Id, subNodeData.Location)
            End If
        Next documentSubNode
    End If

    ' Add links to the ContextNode.
    Me.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer)

    ' Update the partially populated flag.
    analyzerNode.PartiallyPopulated = False

    System.Diagnostics.Debug.Unindent()

End Sub 'IDocumentModel.PopulateNode
        void IDocumentModel.PopulateNode(
            ContextNode analyzerNode,
            InkAnalyzer theInkAnalyzer)
        {
            System.Diagnostics.Debug.WriteLine(string.Format(
                "IDocumentModel.PopulateNode: populate {0} {1}.",
                analyzerNode.ToString(), GetRecognizedString(analyzerNode)));
            System.Diagnostics.Debug.Indent();

            // Get the document node associated with the analyzer node.
            TreeViewItem documentNode = this[analyzerNode.Id];
            if (null == documentNode)
            {
                throw new ApplicationException(
                    "The requested node does not exist in the document model.");
            }

            // Get the data associated with the node.
            DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;

            // Copy any application specific data associated with the node to the
            // partially populated ContextNode.
            foreach (Guid identifier in nodeData.GetPropertyDataIds())
            {
                analyzerNode.AddPropertyData(
                    identifier, nodeData.GetPropertyData(identifier));
            }

            // Check if the partially populated ContextNode is an ink leaf node.
            if (nodeData.IsInkLeafNode)
            {
                // Add the strokes to the context node.
                analyzerNode.SetStrokes(nodeData.Strokes);
            }
            else
            {
                // Add each child subnode as a partially populated ContextNode.
                foreach (TreeViewItem documentSubNode in documentNode.Items)
                {
                    // Get the DocumentNode data for the 
                    DocumentNodeData subNodeData = documentSubNode.Tag as DocumentNodeData;

                    if (analyzerNode.SubNodes.IndexOf(nodeData.Id) != -1)
                    {
                        analyzerNode.CreatePartiallyPopulatedSubNode(
                            subNodeData.Type, subNodeData.Id, subNodeData.Location);
                    }
                }
            }

            // Add links to the ContextNode.
            this.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer);

            // Update the partially populated flag.
            analyzerNode.PartiallyPopulated = false;

            System.Diagnostics.Debug.Unindent();
        }

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

ContextNode クラス

ContextNode メンバ

System.Windows.Ink 名前空間