SymbolItem item = new SymbolItem(); NodeViewModel node = new NodeViewModel() { ... Key = content }; item.Symbol = node; ((SymbolCollection)stencil.SymbolSource).Add(item); |
void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) { if (args.ItemSource == ItemSource.Stencil) { var dropedItem = args.Item as NodeViewModel; ///----------here I want to get "MyKeyObject" var d = dropedItem.Key; // is null if (dropedItem != null) { INodePort port1 = addPort(dropedItem, 0.5, 0.5); dropedItem.Ports = new ObservableCollection<INodePort>() { port1 }; } } } |
NodeViewModel node = new NodeViewModel() { Key="MyKeyObject"... |
symbolstencil.SelectedFilter = new SymbolFilterProvider() { SymbolFilter = Filter };
private bool Filter(SymbolFilterProvider sender, object symbol)
{
return true;
}
Here,
Symbolstencil is instance of Stencil. |