Having trouble getting help?
Contact Support
Contact Support
Scroll Limit in Xamarin Diagram (SfDiagram)
21 Jan 20251 minute to read
The scroll limit allows you to define the scrollable region of the Diagram while pan on the page. The ScrollLimit
property of scroll settings helps to limit the scrolling area. It includes the following options:
- Infinity: Allows you to scroll in all directions without any restriction.
- Diagram: Allows you to scroll within the Diagram content.
- Limited: Allows you to scroll within the specified area.
//Initialize the SfDiagram.
SfDiagram diagram = new SfDiagram();
//Initialize the scroll settings with scroll limit.
diagram.ScrollSettings = new ScrollSettings()
{
ScrollLimit = ScrollLimit.Diagram,
};
Scrollable area
You can restrict scrolling beyond any particular rectangle area by using the ScrollableArea
property of ScrollSettings. To restrict scrolling beyond any custom region,you have to set the ScrollLimit
to Limited. The default value is Rect.Empty.
//Initialize the SfDiagram.
SfDiagram diagram = new SfDiagram();
//Initialize the scroll settings with scroll limit and scrollabl area value.
diagram.ScrollSettings = new ScrollSettings()
{
ScrollLimit = ScrollLimit.Limited,
ScrollableArea = new Rect(0,0,1500,1500),
};
ScrollLimit | Output |
---|---|
Infinity | ![]() |
Diagram | ![]() |
Limited ScrollableArea = (0,0,1500,1500) |
![]() |