Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get Selected item in code (Read 6782 times)
Hai
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 63
Joined: Jan 7th, 2009
Get Selected item in code
Jan 7th, 2009 at 10:45am
Print Post  
Hi there
Your control looks very nice and I'm checking if it will swit our needs...
1. I can not find the way of determining the Selected item. ActiveItem return the last added node, not the selected one.

2. Do you plan of connecting this control to WorkflowFoundation and/or XOML output ?

3. How do I delete a node in code (C#)

4. How do I prevent the user from resizing shapes and adding links ? (Behavior.DoNothink was not the solution...)

Many Thanks

Hai

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Selected item in code
Reply #1 - Jan 7th, 2009 at 12:03pm
Print Post  
Hi,

We've changed a lot of things since the first beta, so try this updated version:

https://mindfusion.eu/_beta/DiagramLite.0.9.3.zip

1.

Code
Select All
private void OnTestClick(object sender, RoutedEventArgs e)
{
	foreach (DiagramItem item in diagram.Selection.Items)
	{
		ShapeNode shape = item as ShapeNode;
		if (shape != null)
			shape.Text = "i'm selected";
	}

	ShapeNode active = diagram.ActiveItem as ShapeNode;
	if (active != null)
		active.Text = "the active item";
}
 



2. What do you mean by "connecting" it?

3.

Code
Select All
diagram.Items.Remove(diagram.Nodes[0]);
 



4. Could be done by handling the LinkCreating and NodeModifying events

Code
Select All
private void OnLinkCreating(object sender, LinkValidationEventArgs e)
{
	e.CancelDrag();
}

private void OnNodeModifying(object sender, NodeValidationEventArgs e)
{
	if (e.AdjustmentHandle != AdjustmentHandles.Move)
		e.CancelDrag();
}
 



however NodeModifying does not work correctly at this time. We'll try to fix it later this week.

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


I love YaBB 1G - SP1!

Posts: 63
Joined: Jan 7th, 2009
Re: Get Selected item in code
Reply #2 - Jan 7th, 2009 at 1:26pm
Print Post  
Hi Stoyo

Thx for the detailed reply… I’m will get into it soon…

Regarding the WF/XOML….

Your control can load and save flow-charts in an XML format…
Workflow foundation is a very good out of the box solution for managing workflows, and is based on XOML files (which are XML files in a specific format)

One of the major problems of the WF is that it works on the server. If your control could give a XOML representation of the flow (into a DOM object or even a string) which can then be sent to the server you will solve a big problem in the industry (Visualize WF on a client-server applications)

Microsoft will love you for that… Wink

Now, I let the user create a flow (this why I use C# in silverlight… I draw the workflow according to the user selections) and then I’ll use a workaround at the moment to send it to the WF but if you will enable this option in the future it will be a great boost for the emerging community of WF & Silverlight users…

TaTa
Hai
  
Back to top
 
IP Logged
 
Hai
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 63
Joined: Jan 7th, 2009
Re: Get Selected item in code
Reply #3 - Jan 7th, 2009 at 2:31pm
Print Post  
Hi Stoyan

All was just as you’ve said Smiley

Please inform me when the next version will be available (NodeModifying thing…)

Many Thanks

Hai

haib@innovashare.com
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Selected item in code
Reply #4 - Jan 7th, 2009 at 2:43pm
Print Post  
Hi Hai,

That's great Wink We'll check the Workflow Foundation thing after we release v1 of the control.

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


I love YaBB 1G - SP1!

Posts: 63
Joined: Jan 7th, 2009
Re: Get Selected item in code
Reply #5 - Feb 24th, 2009 at 9:02am
Print Post  
Hi Stoyan

Any news with the WF XOML ?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Selected item in code
Reply #6 - Feb 25th, 2009 at 1:59pm
Print Post  
Not yet. Let us finish with the basic features first, before moving to such advanced subjects 8)
  
Back to top
 
IP Logged
 
Hai
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 63
Joined: Jan 7th, 2009
Re: Get Selected item in code
Reply #7 - Feb 26th, 2009 at 2:09pm
Print Post  
Hi Stoyan
I'm fine with that…
So let me ask 2 basic questions… Roll Eyes

1. Do you have an Undo / Redo option ? planned maybe ?
2. Is there a way to position the text of a node under the image instead of the center or should I wait for the 1.0.2 version ?
Many thanks
Hai
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Selected item in code
Reply #8 - Feb 27th, 2009 at 7:43am
Print Post  
Hi Hai,

1. We have undo/redo in the controls for other platforms, so I suppose we'll port it to Silverlight version as well.

2. Wait for V1.0.2 if you need this for ShapeNodes. Otherwise create a custom control and host it inside ControlNodes.

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