How to Change Cursor of the Active Tool

2 posts, 1 answers
  1. Michael
    Michael avatar
    26 posts
    Member since:
    Oct 2014

    Posted 23 Dec 2014 Link to this post


    I would like to know if we can change the cursor of the ActiveTool. In particular, when the TextTool is active I would like a different cursor to be displayed (currently it is the same as the PointerTool).  When the Pan Tool is set, the cursor does change, and all the tools derived from ToolBase class have a Cursor property, but it is protected.  Ideally, I'd like to be able to set the TextTool cursor in the XAML.  If there is a way to change the active cursor, what is the best approach?

    Thanks in advance,

  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1452 posts

    Posted 25 Dec 2014 Link to this post

    Hi Mike,

    When it comes to cursors RadDiagram works with the static DiagramCursors class that contains properties of type Cursor. As you noticed each tool expose a Cursor property, which is set to a property of the DiagramCursors class. Which means that if you replace the value (for example) of the DiagramCursors.Path property, the Cursor of the PathTool will be also changed. However, by design the TextTool does not need a special cursor and this is why it uses the default one for the application (the default arrow icon).
    DiagramCursors.Panning = new Cursor("myCursor.cur"); // or whatever cursor you like

    To achieve your requirement you can  change the cursor manually when the ActiveTool of the diagram is changed. For example when you set the ActiveTool to be a TextTool you can also set the Cursor property of the diagram. Then when the ActiveTool is changed back to PointerTool you can set the cursor back to the default pointer cursor.
    //change active tool
    this.diagram.ActiveTool = this.diagram.ActiveTool = MouseTool.PanTool;
    this.diagram.Cursor = DiagramCursors.Panning;
    //change the active back to pointer
    this.diagram.ActiveTool = this.diagram.ActiveTool = MouseTool.PointerTool;
    this.diagram.Cursor = DiagramCursors.Pointer;

    Please let me know if this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top