Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Strange isue with container (Read 2155 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Strange isue with container
Jul 23rd, 2014 at 1:15pm
Print Post  
foreach (var node in form.Nodes)
{
var adapter = node as DiagramNodeAdapter;

if (adapter != null && adapter.Control is ContainerNode)
{
if (adapter.Selected == true)
{
ContainerNode c = (ContainerNode)adapter.Control;
c.Stroke = mycolor;
c.CaptionBackBrush = mycolor;
}
}
}


This code work correclty for all my nodes, but not for containers.
Stoyo, you see sometghing wrong in the code?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange isue with container
Reply #1 - Jul 23rd, 2014 at 1:31pm
Print Post  
Are you sure your containers are inside adapters? Try this instead:

Code
Select All
foreach (var node in form.Nodes)
{
    var container = node as ContainerNode;
    if (container != null && container.Selected)
    {
        container.Stroke = mycolor;
        container.CaptionBackBrush = mycolor;
    }
    // ... handle adapters next
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Strange isue with container
Reply #2 - Jul 23rd, 2014 at 2:05pm
Print Post  
Ok, this way solve the isue. THK!
Why containers nor are inside DiagramNodeAdapter?

var adapter = node as DiagramNodeAdapter;
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange isue with container
Reply #3 - Jul 23rd, 2014 at 2:08pm
Print Post  
DiagramNodeAdapter is used to host custom controls that do not derive from DiagramNode. You could probably host a container inside DiagramNodeAdapter too, but then some features might not work, such as adding children to the container interactively or folding it.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Strange isue with container
Reply #4 - Jul 23rd, 2014 at 2:09pm
Print Post  
Thankyou!
Very usefull info!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint