Page Index Toggle Pages: 1 2 [3] 4  Send TopicPrint
Very Hot Topic (More than 25 Replies) Parallel Connections in Diagrams (Read 27318 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #30 - Mar 17th, 2010 at 3:11pm
Print Post  
It's in the Diagram class, and you will get information about the clicked node and cell through the event-args parameter.
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #31 - Mar 17th, 2010 at 3:25pm
Print Post  
Thanks Stoyan, it worked.

Is it possible to shape a TableNode. Atleast to set a background image and make the borders disappear so that the node shape looks like the image. Or is there any other way to shape the TableNode?

Please help.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #32 - Mar 17th, 2010 at 7:05pm
Print Post  
You can only change the table's shape to a rounded rectangle through its Style property. If you need another shape, I suppose you could set the fill and border colors to Transparent and use an attached ShapeNode or an image for the shape.

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



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #33 - Mar 18th, 2010 at 4:17am
Print Post  
Thanks Stoyan.

I have the following code,

tblNode = diagram.Factory.CreateTableNode(r, 2, 3);
tblNode.CellFrameStyle = CellFrameStyle.None;
Uri ur = new Uri("../../customerSupport.png", UriKind.RelativeOrAbsolute);
Uri ur2 = new Uri("../../EagleHome.png", UriKind.RelativeOrAbsolute);
tblNode.CaptionHeight = 0;
tblNode[1, 0].Image = new BitmapImage(ur);
tblNode[1, 1].Image = new BitmapImage(ur2);

newShape = diagram.Factory.CreateShapeNode(r, Shapes.ManualOperation);
tblNode.AttachTo(newShape, AttachToNode.TopLeft);

Is this what you meant? But this doesn't display a ManualOperation Shape in the UI (Not sure how to set the fill and border property to Transparent).

I just wanted a Shape(ManualOperation) to be displayed in the UI with the table inside it. Also is it possible to fill the table inside the shape.

Please help.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #34 - Mar 18th, 2010 at 8:38am
Print Post  
Try this:

Code
Select All
tblNode.Caption = "";
tblNode.Columns[0].ColumnStyle = ColumnStyle.AutoWidth;
tblNode.Brush = new SolidColorBrush(Colors.Transparent);
tblNode.Pen = new Pen(tblNode.Brush, 1);

newShape = diagram.Factory.CreateShapeNode(r, Shapes.ManualOperation);
tblNode.AttachTo(newShape, 0, 0, 100, 100);
tblNode.ZIndex = newShape.ZIndex;
tblNode.Locked = true;
newShape.Bounds = r;// refresh the group 



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



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #35 - Mar 18th, 2010 at 11:24am
Print Post  
Thanks Stoyan.

Your suggestion worked, is it possible to remove the table border and display only the Shape (ManualOperation).

I have sent you a screen dump of the node.

Please suggest.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #36 - Mar 18th, 2010 at 11:48am
Print Post  
Have you set the table's Pen as in the code above?
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #37 - Mar 18th, 2010 at 12:03pm
Print Post  
Cool.. It worked. Thanks Stoyan.

The same design which we did now (table inside a shape node) can also be achieved by creating a new node on our own or by extending the Control Template of an existing node.

What do you suggest? Which will be the best and optimized way to achieve this?

  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #38 - Mar 18th, 2010 at 2:09pm
Print Post  
If the only extension over standard node appearance required is to draw a second image, I would use custom drawing. It's as easy as setting the CustomDraw property and calling DrawingContext.DrawImage from the Diagram.DrawNode handler.
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #39 - Mar 19th, 2010 at 4:53am
Print Post  
I have sent you an email about my requirements. Please help me finalizing the node creation.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #40 - Mar 19th, 2010 at 6:19am
Print Post  
I'd still use custom-drawing to draw the top-left text and top-right image, and leave the default Image to show the bottom icon with ImageAlign set to BottomCenter.

However since you mentioned you need hit-testing for these elements, things would get more complicated. This will be easier to implement using TableNodes - then you can just handle the CellClicked event. Also instead of creating a group of ShapeNode + TableNode for the first type, you could use a single TableNode that renders the shape through the TableNode.Image property. The Image can be set to a Xaml drawing that renders that shape through a Path object.

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



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #41 - Mar 30th, 2010 at 1:12pm
Print Post  
Thanks Stoyan.

I have sent you an email. Please suggest.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #42 - Mar 30th, 2010 at 2:11pm
Print Post  
If you are already using grouping for this shape anyway, show the exclamation mark using an additional attached ShapeNode.

Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Parallel Connections in Diagrams
Reply #43 - Mar 31st, 2010 at 3:48am
Print Post  
I have a table node placed inside a shape node. Is this what you call Grouping?

Also how to put the exclamation image on top right of the shape node so that it appears partially outside the shape node as in the image which i sent you.

  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Parallel Connections in Diagrams
Reply #44 - Mar 31st, 2010 at 6:10am
Print Post  
Yes, that's grouping. You could add the icon like this:

Code
Select All
DiagramNode CreateNode(Rect rect, double iconSize)
{
	var backgroundShape = diagram.Factory.CreateShapeNode(rect);

	var table = diagram.Factory.CreateTableNode(rect);
	table.AttachTo(backgroundShape, 0, 0, 100, 100);
	// ...

	var icon = diagram.Factory.CreateShapeNode(
		rect.Right - iconSize / 2, rect.Top - iconSize / 2, iconSize, iconSize);
	icon.Shape = Shapes.Alternative; // a triangle
	icon.Text = "!";
	icon.Brush = Brushes.Yellow;
	icon.FontSize = 20;
	icon.TextAlignment = TextAlignment.Center;
	icon.TextVerticalAlignment = AlignmentY.Center;
	icon.AttachTo(backgroundShape, AttachToNode.TopRight);

	return backgroundShape;
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 4 
Send TopicPrint