Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) controlNode and AnchorPattern (Read 7427 times)
Sachin
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
controlNode and AnchorPattern
Mar 18th, 2009 at 10:58am
Print Post  
HI

I am using Control Node to add my CustomImage in Diagramlite pane,
when i am setting Anchor pattern for this controlNode  throwing Object reference not set to an object

how to avoid this one and get the anchor points

   ControlNode cn = new ControlNode(e.Surface as Diagram, droppedElement);

           AnchorPattern apat1 = new AnchorPattern(new AnchorPoint[]{
new AnchorPoint(50, 0, true, true),
new AnchorPoint(100, 50, true, true),
new AnchorPoint(50, 100, true, true),
new AnchorPoint(0, 50, true, true)
});

cn.AnchorPattern = apat1 ;

Error ocuured last line

regards
murugan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #1 - Mar 18th, 2009 at 12:46pm
Print Post  
Hi,

It's a bug; we've fixed it and this will work in v1.0.2. Though now we might have to delay the release until tomorrow.

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


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #2 - Mar 18th, 2009 at 2:19pm
Print Post  
HI

If it is released please send me the link  to get

V1.02  also let me know m how to check whether it is latest or not


Regards
sachin

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #3 - Mar 19th, 2009 at 12:00pm
Print Post  
Hi Sachin,

Please try this with the 1.0.2 beta:
https://mindfusion.eu/_beta/DiagramLite102.zip

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Sachin
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #4 - Mar 19th, 2009 at 12:57pm
Print Post  
HI stoyan

previous version my code  is working fine , new version it is throwing error , how to solve this one

Cannot convert type 'System.Windows.Controls.Panel' to 'MindFusion.Diagramming.Silverlight.Diagram'

regards
murugan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #5 - Mar 19th, 2009 at 1:07pm
Print Post  
Hi,

Now Diagram derives from Control instead of Canvas. Why do you need to cast it to Panel?

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


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #6 - Mar 19th, 2009 at 1:14pm
Print Post  
HI stoyan

i ma using drag and drop functionality images are in silverlight panel ,   i am doing  drag the image and  add dto diagramlite , that is the purpose converting panel to diagramlite , now how to achive this functionality please let me know ..


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #7 - Mar 19th, 2009 at 1:32pm
Print Post  
You want to add an Image control directly to the diagram canvas, using Panel.Children.Add? It's not recommended, and is not possible anymore anyway unless we expose the internal canvas as a property of Diagram. Either add a ShapeNode and set its Image property (optionally set Transparent = true to hide the shape), or add a ControlNode that hosts an Image control. In both cases you don't need to cast the Diagram to Panel.
  
Back to top
 
IP Logged
 
Sachin
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #8 - Mar 19th, 2009 at 5:54pm
Print Post  
HI stoyo
if i am using control Node in constructoor need to pass diagram  object ,here only need to convert the panel as diagram object , this is in different layer not in same layer , how to approach here


  ControlNode cn = new ControlNode(e.Surface as Diagram, droppedElement);

          AnchorPattern apat1 = new AnchorPattern(new AnchorPoint[]{
new AnchorPoint(50, 0, true, true),
new AnchorPoint(100, 50, true, true),
new AnchorPoint(50, 100, true, true),
new AnchorPoint(0, 50, true, true)
});

cn.AnchorPattern = apat1 ;


regards
sachin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #9 - Mar 19th, 2009 at 6:42pm
Print Post  
Hi Sachin,

What exactly is that e.Surface argument? If you are using some third party library that implements drag-and-drop and gives you the UIElement under the mouse, you could use the UIElement.Parent property to get to the Diagram.

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


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #10 - Mar 20th, 2009 at 5:08am
Print Post  
In my application I implemented a custom drag and drop functionality. I had written code for moving Node as per mouse movements when user initiates a drag, to implement this I will be moving this Node as is moving across various panels. Ultimately, this Node will be dropped on DiagramLite. Once it is dropped e.Surface will have reference to dropped surface element. It could be any UIElement, but assumption was it will be derived from Panel.  As you had changed Diagram class inheritance itself, to fix earlier bug, it is breaking compatibility. Hope this helps in explaining my requirement.... Any help will be highly appreciable...
thnx.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: controlNode and AnchorPattern
Reply #11 - Mar 20th, 2009 at 7:06am
Print Post  
We need the diagram to derive from Control because of the keyboard focus management methods that are missing from Panel classes. Now the canvas is set as diagram.Content, and you can access the Diagram using the Parent property. Parent is not defined in UIElement, but in FrameworkElement. That should be ok, since the panel classes are FrameworkElements anyway.

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


I love YaBB 1G - SP1!

Posts: 85
Joined: Mar 14th, 2009
Re: controlNode and AnchorPattern
Reply #12 - Mar 20th, 2009 at 8:08am
Print Post  
HI

Thanks a lot it is working Smiley

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