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
Thank you for your interest in RadDiagram. The simple answer to all your questions is "Yes, you can.".
But let me go through them:
- You can very easily accomplish this layout using RadDiagram - read more here.
- You can set different colors to the arrows, or have different types of arrows actually. Read more.
- You can also add ContextMenu to the shapes, but you can also use our built-in Settings pane as well.
- The Shape has ContentTemplate that is of type DataTemplate, so you can easily customize it - read more here.
- 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.
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.
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'.
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.
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.
<telerik:RadDiagram x:Name="graphLayout" GraphSource="{Binding Graph}" />
Thanks.
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.
Hristo
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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.
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