evaluating diagram

12 posts, 0 answers
  1. fabrizio
    fabrizio avatar
    6 posts
    Member since:
    Oct 2010

    Posted 26 Sep 2012 Link to this post

    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!



  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 26 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. fabrizio
    fabrizio avatar
    6 posts
    Member since:
    Oct 2010

    Posted 26 Sep 2012 Link to this post

    thanks, i'm downloading the trial, tomorrow i'll made all tests i  need .
  5. fabrizio
    fabrizio avatar
    6 posts
    Member since:
    Oct 2010

    Posted 27 Sep 2012 Link to this post

    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'.
  6. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 27 Sep 2012 Link to this post

    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.

  7. fabrizio
    fabrizio avatar
    6 posts
    Member since:
    Oct 2010

    Posted 10 Oct 2012 Link to this post

    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.
  8. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 12 Oct 2012 Link to this post

    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.

  9. Rajinder
    Rajinder avatar
    2 posts
    Member since:
    Jan 2013

    Posted 29 Jan 2013 Link to this post

    Can you please provide a C# code to add ContextMenu to RadDiagram Shapes.
  10. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 31 Jan 2013 Link to this post

    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.

  11. John
    John avatar
    17 posts
    Member since:
    Aug 2014

    Posted 24 Aug Link to this post

    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?
  12. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 25 Aug Link to this post

    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.
  13. John
    John avatar
    17 posts
    Member since:
    Aug 2014

    Posted 25 Aug in reply to Martin Link to this post

    Thanks for the quick response. I found the problem: the shape was using a standard ContextMenu, not RadContextMenu.ContextMenu property.
Back to Top
UI for WPF is Visual Studio 2017 Ready