Applies to: Nevron Diagram for .NET
How to automatically set the name/prompt for the library masters when a node is dropped into a library?
The NodeInserted event will be fired when a new master has been created to adopt any dropped shapes.
You can use the following code to automatically set the names when of the new masters:
[C#]
libraryDocument.EventSinkService.NodeInserted =
new
ChildNodeEventHandler(OnLibraryNodeInserted);
…
public
void
OnLibraryNodeInserted(NChildNodeEventArgs args)
{
if
(args.Child
is
NMaster)
{
NMaster master = args.Child
as
NMaster;
master.Prompt =
"My prompt"
;
}
}
[VB.NET]
...
AddHandler
libraryDocument.EventSinkService.NodeInserted,
AddressOf
OnLibraryNodeInserted
...
Public
Sub
OnLibraryNodeInserted(args
As
NChildNodeEventArgs)
If
TypeOf
args.Child
Is
NMaster
Then
Dim
master
As
NMaster = TryCast(args.Child, NMaster)
master.Prompt =
"My prompt"
End
If
End
Sub
Article ID: 42, Created On: 10/5/2010, Modified: 5/5/2011