Proprietà ContextNode.PartiallyPopulated
Aggiornamento: novembre 2007
Ottiene o imposta un valore che indica se un oggetto ContextNode è parzialmente o completamente popolato.
Spazio dei nomi: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Sintassi
'Dichiarazione
Public Property PartiallyPopulated As Boolean
'Utilizzo
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)
Valore proprietà
Tipo: System.Boolean
true se l'oggetto ContextNode contiene dati parziali durante il processo del proxy di dati; false se sono stati aggiunti tutti i dati.
Note
Utilizzare questa proprietà per il proxy di dati quando gli oggetti ContextNode vengono creati nella struttura ad albero del nodo di contesto prima che siano disponibili tutte le informazioni. Questa proprietà indica se i dati sono stati completamente popolati.
Esempi
Nell'esempio seguente viene illustrato un metodo denominato PopulateNode, da un codice di esempio che utilizza un oggetto [System.Windows.Controls.TreeView] come modello di documento per mostrare come il proxy di dati può essere utilizzato per archiviare e caricare una struttura ad albero del nodo di contesto per un oggetto InkAnalyzer. La classe DocumentNodeData archivia i dati di ContextNode nel modello di documento quando la proprietà [System.Windows.FrameworkElement.Tag] di ogni oggetto TreeViewItem è impostata su un oggetto DocumentNodeData.
Il metodo PopulateNode utilizza un oggetto ContextNode e un oggetto InkAnalyzer per popolare completamente il nodo di contesto aggiungendo tratti, dati delle proprietà, tipo di annotazione, nodi figlio e collegamenti. I dati provengono dall'oggetto DocumentNodeData ottenuto dall'oggetto TreeViewItem corrispondente.
this[analyzerNode.Id] è un indicizzatore nella classe del modello di documento che esegue il mapping di Guid a un oggetto TreeViewItem.
AddLinksToAnalyer è un metodo nella classe del modello di documento che aggiunge collegamenti all'oggetto ContextNode.
Una volta popolato completamente il nodo, la proprietà PartiallyPopulated viene impostata su 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();
}
Piattaforme
Windows Vista
.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Informazioni sulla versione
.NET Framework
Supportato in: 3.0