I'm using the Diagrams Framework in a project. I thought it would be nice to have a way of panning without the need of zoom. In your demos the IsPanEnabled is set but there is no way to pan around. I known that if you zoom the position of your cursor is used to pan but having some kind of hand-cursor to move the whole diagram around would be a pleasure. Have I missed a possibility to achieve this in the current version or are there any plans to include such a thing in a future version?
Best Regards,
Peter Schmidt
7 Answers, 1 is accepted
By the default, the Panning feature is turned on. You can disable this functionality by setting the RadDiagram.IsPanEnabled property to False. Once the panning is enabled, you can press Ctrl + MouseLeftButton and start panning the RadDiagram. Read the help here.
You can also change the current mouse tool to hand (pan) tool easily - read more.
Please let us know if you have further questions.
Miro Miroslavov
the Telerik team
thanks! I did not know that. The shortcut is not standard so I did not try this combination. There is still a problem with this but therefore I need to describe the scenario:
I am using Image Elements in Diagram to display a zooming background. So a great portion of the canvas is filled with DiagramShapes. The panning tool is only working on areas without any shapes underneath it. For an editing scenario this makes perfect sense. But I am using Diagram to display plans and the whole control is readonly. So it would be great if I could pan while hovering over shapes, too.
Kind Regards,
Peter Schmidt
If your shapes are 100% readonly, you can set the IsEnabled prop. to False, which will prevent the Hit Test service and so the panning will work everywhere.
Also note that you can change the short keys for the panning (if CTRL is not ok for you).
On a side note, we're considering to implement Scrolling option - you can vote and check the backlog item here.
Miro Miroslavov
the Telerik team
Hi, How to change the default Ctrl+MouseLeftButton panning to just Mouse Left button down and drag?
Thanks,
This will happen if you set ActiveTool property to PanTool. Is this an option or you need a mixed mode - clicking on shape to move the shape, clicking on empty space on diagram to start pan tool ?
Regards,
Petar Mladenov
Telerik by Progress
Hi Petar,
Looking for the mixed mode. is there a way to set it?
Thanks.
You can develop custom Pointer Tool class which extends the one that is built-in and default in RadDiagram. Please find a sample code below:
public
class
CustomPointerTool : PointerTool
{
public
override
bool
MouseDown(PointerArgs e)
{
bool
result =
base
.MouseDown(e);
if
(
this
.HitItem ==
null
)
{
this
.ToolService.ActivateTool(PanningTool.ToolName);
return
false
;
}
return
result;
}
public
override
bool
MouseUp(PointerArgs e)
{
bool
result =
base
.MouseUp(e);
if
((
this
.Graph
as
RadDiagram).ActiveTool == MouseTool.PanTool)
{
(
this
.Graph
as
RadDiagram).ActiveTool = MouseTool.PointerTool;
}
return
result;
}
}
public
Example()
{
InitializeComponent();
ToolService toolService =
this
.xDiagram.ServiceLocator.GetService<IToolService>()
as
ToolService;
if
(toolService !=
null
)
{
toolService.ToolList[0] =
new
CustomPointerTool();
For more information regarding tools customization in RadDiagram you can take a look at:
Diagram Tools Customization
Diagram Custom Tools SDK
Diagram Custom Connector Tools SDK
Regards,
Petar Mladenov
Telerik by Progress