Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Identify Shapenodes on SubHeaders (Read 3755 times)
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Identify Shapenodes on SubHeaders
Oct 4th, 2010 at 3:32pm
Print Post  
Hello,

i have a LaneGrid with one column and some subheaders. I would like to identify my shapenodes on every subheader.

1. Does WPF-Diagramming have functions to identify shapenodes on subheaders?

2. How can i get a collection of all shapenodes of one shapenode class (I use different Shapenode classes)?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identify Shapenodes on SubHeaders
Reply #1 - Oct 4th, 2010 at 4:33pm
Print Post  
Hi,

1. You can use GetCellBounds to get the bounding rectangle of the lane, and then check if it intersects with the node:

var grid = diagram.LaneGrid;
Rect r = grid.GetCellBounds(grid[...]);
var laneNodes = from DiagramNode node in diagram.Nodes where node.Bounds.IntersectsWith(r) select node;

2. Using an expression as above, but change the where clause to 'where node is MyNodeType'.

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


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: Identify Shapenodes on SubHeaders
Reply #2 - Oct 5th, 2010 at 2:29pm
Print Post  
Hi Stoyan,

thank you for your reply.

i would like to use getCellBounds on Subheaders:

Something like:
Code
Select All
var grid = diagram.LaneGrid.ColumnHeaders[0];
rect r = grid.GetCellBounds(grid[0,2];
var laneNodes = from DiagramNode node in diagram.Nodes where node.Bounds.IntersectsWith(r) select node;
 



1. Is something like that implemented?
2. I would like to Display all Shapes of one Class on the Diagram in a DataGrid. When I add or remove Shapes, the DataGrid will not be updated.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identify Shapenodes on SubHeaders
Reply #3 - Oct 6th, 2010 at 6:53am
Print Post  
Hi,

1. You can use the [Header, Header] indexer overload to get an ICell representing a whole row or column, by setting respectively the column or row header arguments to null. Then calling GetCellBounds() on that ICell will return the bounding rectangle for the whole row or column.

2. I suppose you could handle the ItemAdded event and if the new item is the node type displayed in the grid, add it to the list from the initial query.

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


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: Identify Shapenodes on SubHeaders
Reply #4 - Oct 6th, 2010 at 3:32pm
Print Post  
Hi Stoyan,

1. thanks, it works very well!

2. Thank you for this hint. I display the node.Text also on the grid. I found the handle itemadded and itemremoved. So i guess i have to create an itemchanged event?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identify Shapenodes on SubHeaders
Reply #5 - Oct 6th, 2010 at 5:10pm
Print Post  
Hi,

You can handle the NodeTextEdited event to detect text changes, or you might try binding to DiagramItem.Text - it is a dependency property.

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


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: Identify Shapenodes on SubHeaders
Reply #6 - Oct 7th, 2010 at 3:21pm
Print Post  
Hi Stoyan,

thank you for your advices. I am not that familiar with this Collections so i hope i would appreciate to get 2 more advices.

I have a Datacontext set from my Grid
Code
Select All
MyGrid.DataContext = objProcess.diagProcessDiagram.Nodes; 



I get a collection of all Nodes.

1. I want to set a Filter on a special Type of Node.
2. Has this Collection the Interface INotifyCollectionChanged?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Identify Shapenodes on SubHeaders
Reply #7 - Oct 7th, 2010 at 5:30pm
Print Post  
Hi,

1. I suppose that depends on the grid control you are using. If it's the one from the WPF Toolkit, you can find an example here:
http://yogesh.jagotagroup.com/blog/post/2008/11/01/Filtering-WPF-toolkit-DataGri...

2. It doesn't. By handling ItemAdded as above, you could add the specific type of nodes to an ObservableCollection and set it as the grid's source.

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