Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic diagram.ActiveItem (Read 3023 times)
donalmeida
Junior Member
**
Offline


Yay...

Posts: 65
Joined: Oct 6th, 2009
diagram.ActiveItem
Oct 22nd, 2012 at 1:52pm
Print Post  
Hi, We upgraded our controls to Silverlight 5 (2.3.0.16737) and this code stopped working. on Key_Down event we trap the delete key event and run this code

  CustomDiagramLink link = currentDiagram.ActiveItem as CustomDiagramLink;
            if (link != null)
            {
                DeleteRoute(link);
            }
            DiagramNode node = currentDiagram.ActiveItem as DiagramNode;
            if (node != null)
            {
                DeleteNode(node);
            }

This used to work before but now diagram.ActiveItem is null. is there a better way to do this?

  

Don Almeida.
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagram.ActiveItem
Reply #1 - Oct 22nd, 2012 at 2:01pm
Print Post  
The control might be deleting the ActiveItem automatically now. Try setting DelKeyAction=None if you wish to process Del yourself.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
donalmeida
Junior Member
**
Offline


Yay...

Posts: 65
Joined: Oct 6th, 2009
Re: diagram.ActiveItem
Reply #2 - Oct 22nd, 2012 at 8:34pm
Print Post  
I tried it Stoyan, but the ActiveElement is still null. it is null even in this event handler. (of course i can get the link from the event args but in this case I was just checking if setting the delkey action helps me or not).



private void diagram_LinkDeleted(object sender, LinkEventArgs e)
        {
            DiagramItem dgi = currentDiagram.ActiveItem;
            if (dgi != null)
            {
                // check B rules
            }
  

Don Almeida.
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagram.ActiveItem
Reply #3 - Oct 23rd, 2012 at 6:23am
Print Post  
Diagram.ActiveItem is automatically set to null when the item is deleted, so if you need to know what has been deleted, you will have to check the LinkEventArgs indeed.

In any case, I don't think you can get to the LinkDeleted event if DelKeyAction is set to None and you are not deleting the items yourself in response to Del key, so check your code again: either DelKeyAction is disabled and you manage to delete ActiveItem from the KeyDown handler, or DelKeyAction is enabled and you are getting LinkDeleted raised because of it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint