This is a migrated thread and some comments may be shown as answers.

evaluating diagram

11 Answers 189 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
fabrizio
Top achievements
Rank 1
fabrizio asked on 26 Sep 2012, 03:48 PM
hi all, i've a graph editor using other graph component (graph#), now i'm evaluating to replace it with telerik diagram...

the actual component layout the graph with some predefined alghoritm and there's no way to store the changes the user made on the layout. the user can move a node but i cant get the new position when i save the diagram and store the changes...

So the most important requirment is to get and set for each node the location (x,y).

i need to link two nodes with two types of arrow, can telerik set a color for arrow depending on view model?

can i add a context menu to each node?

can i style the node using datatemplate?

add a pic to see the actual

thanks!



11 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 26 Sep 2012, 03:59 PM
Hi fabrizio, 
Thank you for your interest in RadDiagram. The simple answer to all your questions is "Yes, you can.".
But let me go through them:
  1. You can very easily accomplish this layout using RadDiagram - read more here.
  2. You can set different colors to the arrows, or have different types of arrows actually. Read more.
  3. You can also add ContextMenu to the shapes, but you can also use our built-in Settings pane as well.
  4. The Shape has ContentTemplate that is of type DataTemplate, so you can easily customize it - read more here.
  5. You can also get/set and save(serialize) the Position of a shape very easily. It is the RadDiagramShape.Position property of type Point. 

Basically you can very easily accomplish the things you mentioned and way more if you need to.
Please let us know if you have further questions. 

All the best,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
fabrizio
Top achievements
Rank 1
answered on 26 Sep 2012, 04:01 PM
thanks, i'm downloading the trial, tomorrow i'll made all tests i  need .
0
fabrizio
Top achievements
Rank 1
answered on 27 Sep 2012, 10:28 AM
hi, i began my test by this code : http://www.telerik.com/help/wpf/raddiagram-data-databinding.html

when i try to move a node i get this error "GraphSource must implement IObservableGraphSource"

also i would like to know if the drag and drop to made connetions can be disabled and also the routate and edit node, i need a readonly node just the click event i need to handle.

Locating source for 'c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs'. Checksum: MD5 {b6 86 df e7 67 a4 32 d7 a 62 5f 8d 1c d9 e8 9d}
The file 'c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs' does not exist.
Looking in script documents for 'c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs'...
Looking in the projects for 'c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs.
The debugger could not locate the source file 'c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Diagrams\Diagrams\RadDiagram.cs'.
0
Miro Miroslavov
Telerik team
answered on 27 Sep 2012, 01:05 PM
Hello fabrizio,

 This exception is raised when the user (you) tries to Add/Remove shape or connection using the API or through the User Interface. So if basically you'll need IObservableGraphSource if you want your users to be able to connect items or to add new shapes. 
Otherwise you can set a bunch of properties to make the diagram "Read-only" - You can refer to that article here. (IsConnectorsManipulationEnabled  is particularly what you need.)
Please let us know if you have further questions. 

All the best,
Miro Miroslavov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
fabrizio
Top achievements
Rank 1
answered on 10 Oct 2012, 03:27 PM
HI, i placed raddiagram inside a datatemplate so i cant access it directly from code behind, i need to call the autofit() method, is there a way to call from viemmodel?

<telerik:RadDiagram x:Name="graphLayout"  GraphSource="{Binding Graph}" />

Thanks.
0
Hristo
Telerik team
answered on 12 Oct 2012, 06:55 AM
Hi,

You could use the AutoFit command (DiagramCommands.AutoFit) and set it to a Command property of a button together with the CommandTarget pointing to the required diagram.
Another solution is to do a visual tree traversal for element of type RadDiagram (for example ChildrenOfType or ParentOfType).
Hope this helps. Please let us know if you need more info or none of the two approaches fit in your case.

Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rajinder
Top achievements
Rank 1
answered on 29 Jan 2013, 10:04 AM
Can you please provide a C# code to add ContextMenu to RadDiagram Shapes.
0
Pavel R. Pavlov
Telerik team
answered on 31 Jan 2013, 05:05 PM
Hi Rajinder,

In order to create a context menu you can use our attached property RadContextMenu.ContextMenu. You can read more information about the RadContextMenu control here. You can achieve the same in code behind with the following code:
RadContextMenu menu = new RadContextMenu();
menu.Items.Add(new RadMenuItem() { Header = "item 1" });
menu.Items.Add(new RadMenuItem() { Header = "item 2" });
 
this.shape1.SetValue(RadContextMenu.ContextMenuProperty, menu);

You can read more about attached properties here.

All the best,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
John
Top achievements
Rank 1
Iron
answered on 24 Aug 2016, 04:56 PM
I'm attempting to do just that with an additional caveat: There is also a RadContextMenu attached to the RadDiagram itself. Every time I try to pop the shape's context menu, the diagram's shows up. Is there any way to acheive this?
0
Martin Ivanov
Telerik team
answered on 25 Aug 2016, 07:59 AM
Hi John,

I tested your case with the following XAML definition but the context menus are displayed as expected.
<telerik:RadDiagram>
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu>
            <telerik:RadMenuItem Header="Diagram menu item 1" />
            <telerik:RadMenuItem Header="Diagram menu item 2" />
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
    <telerik:RadDiagramShape Content="Shape 1">
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu>
                <telerik:RadMenuItem Header="Shape menu item 1" />
                <telerik:RadMenuItem Header="Shape menu item 2" />
            </telerik:RadContextMenu>
        </telerik:RadContextMenu.ContextMenu>
    </telerik:RadDiagramShape>
</telerik:RadDiagram>

Let me know if I am missing something.

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
John
Top achievements
Rank 1
Iron
answered on 25 Aug 2016, 01:50 PM
Thanks for the quick response. I found the problem: the shape was using a standard ContextMenu, not RadContextMenu.ContextMenu property.
Tags
Diagram
Asked by
fabrizio
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
fabrizio
Top achievements
Rank 1
Hristo
Telerik team
Rajinder
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
John
Top achievements
Rank 1
Iron
Martin Ivanov
Telerik team
Share this question
or