Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Re: layout for silverlight diagramming (Read 8249 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Nov 28th, 2011 at 5:58pm
Print Post  
Hi,

Check TreeLayout and LayeredLayout,  they are shown in the first two tutorials.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #1 - Nov 29th, 2011 at 10:00am
Print Post  
http://www.mindfusion.eu/onlinehelp/diagramlite/index.htm?Tutorial_1__Loading_Gr...

You can also find the tutorial projects under the control's installation folder.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #2 - Nov 30th, 2011 at 5:54pm
Print Post  
hi

i set layout of diagram using

var layout = new MindFusion.Diagramming.Silverlight.Layout.TreeLayout
layout.Arrange(siteMap);

its looking fine like organisation chart but the lines are straight lines between nodes i want them like in organisation chart (bended hierarchy one)
what property i cant set
and

how to set image in a node..?


thanks

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #3 - Nov 30th, 2011 at 6:06pm
Print Post  
Set TreeLayout.LinkStyle to Cascading3. If you are using ShapeNodes, you can set their Image property. See tutorial 3 for an example showing how to show an image from Xaml template.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #4 - Dec 1st, 2011 at 10:41am
Print Post  
hi,

i set
           node.ImageAlign = ImageAlign.MiddleLeft;
           node.ImageStretch = Stretch.Uniform;
           //node.ResizeToFitText();
           node.TextAlignment = TextAlignment.Right;
           node.Transparent = true;
           node.TextWrapping = TextWrapping.Wrap;
           siteMap.AutoScroll = true;

but image and text are overlapping i want wrapped text by the side of image
and
how can i resizeto fit diargram so that whole treeview can be  viewed (organisation chart)
i set
               siteMap.ResizeToFitItems(0.2);
               siteMap.AutoScroll = true;
              layout.Type = TreeLayoutType.Centered;

when i bind to template as shown in tutorial 3
its not showing any image or text only links are visible..? i am not setting bounds..


many thanks


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #5 - Dec 1st, 2011 at 11:12am
Print Post  
Hi,

If you need the image and text displayed side by side in a ShapeNode, you will have to define a custom Shape that provides a TextRectangle and ImageRectangle coordinates.

You should call ResizeToFitItems after applying the layout, not before that.

Regarding the tutorial, check if you haven't omitted the DefaultStyleKey = typeof(OrgChartNode) assignment. Perhaps it will be easier to add the OrgChartNode files to your project and refactor them for your needs.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #6 - Dec 1st, 2011 at 12:22pm
Print Post  
hi,

no i am not missing

DefaultStyleKey = typeof(OrgChartNode)

<Image Source="{TemplateBinding Image}"
Stretch="Uniform">
</Image>
<TextBlock Text="{TemplateBinding Text}" FontSize="9" />
nodes are added
var  node = new OrgChartNode
{
Text = name,
Image = new BitmapImage(new Uri("person.jpg", UriKind.Relative))
Bounds = new Rect(0, 0, 20, 10)
};

node.Id = id;
siteMap.Nodes.Add(node);

still not showing text /images

how come the tutorial showing images text side by side with out custom shape classe

thanks
« Last Edit: Dec 1st, 2011 at 2:20pm by vchimakurthi »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #7 - Dec 1st, 2011 at 1:04pm
Print Post  
What does your full template look like?

The tutorial completely replaces the ShapeNode template to specify image and text position, so it does not need a custom Shape. You need custom shapes only to do that with standard ShapeNodes.
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #8 - Dec 1st, 2011 at 5:08pm
Print Post  
hi

is generic.xaml need to be in themes folder ?
then it shows nodes otherwise not

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #9 - Dec 1st, 2011 at 6:08pm
Print Post  
Hi,

Yes, generic.xaml must reside in the themes folder, otherwise Silverlight cannot find the template.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #10 - Dec 5th, 2011 at 1:58pm
Print Post  
hi ,
context menu is not displaying at mouse position.
i write the code like

private void OnNode_Clicked(object sender, NodeEventArgs e)
{
if (e.MouseButton == MouseButton.Right)
{
Point p = e.MousePosition;
ctxpopup.Visibility = Visibility.Visible;
ctxpopup.IsOpen = true;
ctxpopup.SetValue(Canvas.LeftProperty, (double)p.X);
ctxpopup.SetValue(Canvas.TopProperty, (double)p.Y);

}
}
but displays at random location

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #11 - Dec 5th, 2011 at 2:48pm
Print Post  
The e.MousePosition property returns the position in diagram's logical coordinates. In the general case, they are not the same as the coordinates relative to the application's root element - e.g. when the diagram is scrolled, zoomed, or has some margin relative to the root visual. You can get the position relative to a parent element like this:

Code
Select All
var transform = diagram.DocumentPlane.TransformToVisual(parentCanvas);
var position = transform.Transform(e.MousePosition);
// assuming ctxpopup position is relative to parentCanvas
ctxpopup.SetValue(... position.X ...);  



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vchimakurthi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Apr 6th, 2011
Re: layout for silverlight diagramming
Reply #12 - Dec 6th, 2011 at 9:19am
Print Post  
hi ,

thats working fine thanks.
i am showing context menu (popup) on node click.
it works fine only once its not showing popup again
i need to refresh the screen every time...?

           ctxpopup.Child = propGrid;
           ctxpopup.VerticalOffset = 75.0;
           ctxpopup.HorizontalOffset = 25.0;
           ctxpopup.IsOpen = true;
on  click event

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: layout for silverlight diagramming
Reply #13 - Dec 6th, 2011 at 9:39am
Print Post  
Hi,

Doesn't the NodeClicked event get fired anymore, or setting ctxpopup.IsOpen = true doesn't show the menu?

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