Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How can we access DiagramView from a DiagramNode (Read 2730 times)
chiru29
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 35
Location: Hyderabad
Joined: Jul 16th, 2010
How can we access DiagramView from a DiagramNode
Jul 22nd, 2010 at 9:04am
Print Post  
Hi,

If i have a DiagramNode in a diagram, i am able to access the diagram by DiagramNode.Parent property.

Same way, can i access DiagramView from a diagram node?

Thanks
Chiru
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can we access DiagramView from a DiagramNo
Reply #1 - Jul 22nd, 2010 at 10:29am
Print Post  
Hi,

Neither a Diagram nor its nodes know what DiagramViews they are displayed in. There's a way to access the view from a DiagramNode.Draw override - use the TargetView property of the options argument. If you are using multiple views and need to access them in other situations, you could build a Dictionary<Diagram, List<DiagramView>> map that lets you find them.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
chiru29
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 35
Location: Hyderabad
Joined: Jul 16th, 2010
Re: How can we access DiagramView from a DiagramNo
Reply #2 - Jul 22nd, 2010 at 11:52am
Print Post  
Thanks Stoyan.


If you can give me an example of this, that whould be very helpful.


Thanks
Chiru
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can we access DiagramView from a DiagramNo
Reply #3 - Jul 22nd, 2010 at 12:23pm
Print Post  
Code
Select All
private Dictionary<Diagram, List<DiagramView>> viewMap =
	new Dictionary<Diagram, List<DiagramView>>();

void AddView(Diagram d, DiagramView v)
{
	if (!viewMap.ContainsKey(d))
		viewMap[d] = new List<DiagramView>();
	viewMap[d].Add(v);
}

List<DiagramView> GetViews(DiagramNode node)
{
	return viewMap[node.Parent];
} 



Call AddView each time you create a new view for a diagram, and GetViews when you need to find out the views that display some node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
chiru29
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 35
Location: Hyderabad
Joined: Jul 16th, 2010
Re: How can we access DiagramView from a DiagramNo
Reply #4 - Jul 23rd, 2010 at 11:07am
Print Post  
Thanks. It is very helpful.



Regards
Chiru
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint