共用方式為


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 在資料 Proxy 程序期間包含部分資料,則為 true,如果已加入全部資料,則為 false。

備註

在內容節點樹狀目錄中建立 ContextNode 物件時,您可以在提供所有資訊之前,使用這個屬性做為資料 Proxy。這個屬性表示是否已填入所有資料。

範例

下列範例是來自範例程式碼的 PopulateNode 方法,它會使用 [System.Windows.Controls.TreeView] 做為文件模型,以顯示如何使用資料 Proxy 儲存和載入 InkAnalyzer 的內容節點樹狀目錄。DocumentNodeData 類別會在每個 TreeViewItem 物件的 [System.Windows.FrameworkElement.Tag] 屬性都設定為 DocumentNodeData 物件時,將 ContextNode 資料儲存在文件模型中。

PopulateNode 方法會使用 ContextNode 物件和 InkAnalyzer 物件,透過加入筆劃、屬性資料、註釋型別、子節點和連結完整地填入內容節點。資料來自 DocumentNodeData 物件,而該物件是從對應的 TreeViewItem 取得。

  • this[analyzerNode.Id] 是文件模型類別上的索引子,會將 Guid 對應至 TreeViewItem

  • 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 命名空間