Sneak peek: The Snap Lines feature in XtraReports v2009.3

27 November 2009

A few weeks ago I published a blog post about the new report designer in our reporting product. This is due to be released very soon and, to be honest, for such a great feature, my post left a little to be desired in terms of details. Alex, who writes for the XtraCharts and XtraReports teams, thought it would be a good idea for me to interview members of the development team and get them to reveal more about the new XtraReports.

Dmitry In this first article, he hooked me up with Dmitry Barakhov (whose handle is Dem in the forums), and Dmitry talked about the Snap Lines feature he implemented.

JMB: First of all, what do "snap lines" mean and what is their purpose?

Dem: Basically, snap lines are for the design-time positioning of different UI elements; in our case, for the positioning of report controls.

Let me give you a little background and tell you about the history of this problem. It is common practice to have a report with elements' edges aligned with other elements' edges. To solve this task in XtraReports prior to v2009.3, we had a grid of dots and you positioned controls on that grid:


However this approach has several drawbacks. First, the corresponding preview of a document will differ from its design-time representation because there will be no dots in the preview. Obviously so — the grid is presented at design time but is not visible at runtime, so having the grid means the user does not get a true visualization of what the runtime preview of the document will look like.

On the sixth day of DevExpress Christmas, I found the new and improved XtraReports Script Editor Another problem with this approach is the necessity to have report elements already aligned to the grid so that other elements would have the ability to be aligned to them. Sometimes this is just not very convenient (in the picture above you can see that xrLabel2 is aligned to the grid but not to the left coordinate of xrLabel1, we have to make sure that's aligned to the grid ourselves).

The 'snap lines' approach, introduced by the Visual Studio Windows Forms designer as well as designers like Blend, doesn't have these shortcomings. It can work without a grid and it allows you to precisely align a control to another control's coordinates.


JMB: Are snap lines enabled by default?

Dem: Yes. In fact there is a new property in XtraReports — SnappingMode — that regulates this behavior. Its default value is set to SnapLines, but the user can switch to SnapToGrid to return to the old behavior.

JMB: When are snap lines functional? Only during the drag-and-drop of controls within a band?

Dem: Snap lines certainly work during the dragging of controls within a band, but they also work when drag-dropping from one band to another (by the way, snap lines can be disabled during a drag-drop operation by pressing the ALT key). Not only that, but they are also functional during resizing either by using the mouse or keyboard. And finally, they are operative when picking a control from a toolbox and dropping it onto a report.

JMB: What kinds of snap lines are supported by XtraReports in v2009.3?

Dem: For now I've implemented what might be called the "bounds" type of snap lines — that is, the ability to align a report element to another report element's Left, Top, Right, or Bottom coordinates — and the "margin" type of snap lines — that is, the ability to indent a control from another control. This indent is specified by a control's SnapLineMargin and SnapLinePadding for container controls like the XRPanel and XRTableCell.

JMB: Neat. Any plans for expanding this functionality in the future, or (laughs) is there nothing left to do?

Dem: Of course there is more to do [;-)]. For example: snap lines that align to the "Base line" of text is another cool kind of snap line that we are going to implement in the near future. Another is  the ability to add custom snap lines and the ability to restrict certain kinds of snap lines on a particular control.

JMB: Dmitry, thank you for talking with me. Good luck with extending snap lines in future releases!

Dem: You are always welcome!

8 comment(s)
Charles Russell

Will this be available in the end user designer as well?

This is a major improvement - it is one of the reasons why I've been investigating a competitor of yours, which already has that feature. It is invaluable when working with invoice forms...

27 November, 2009
Alan (DevExpress)

Hello Charles,

Yes, this feature will be available both at Visual Studio design time and in the End-User Report Designer!

27 November, 2009
Julian Bucknall (DevExpress)

Charles: Although Alan has replied, I think it would be a good idea to reinforce the point that the report designer for XtraReports in Visual Studio is exactly the same as the end-user report designer you can include in your own applications. In other words, when you design a report in VS, you are already using the end-user report designer. We are all end-users Smile.

Cheers, Julian

27 November, 2009
Karl Rostock_2

@Julian M Bucknall

Am i right in saying that the winforms development has stopped and that you will not be adding any new controls or significantly changing existing ones?

I see there are little updates for winforms etc but all the breaking changes and new features seem to be for WPF and



28 November, 2009
Karl Rostock_2

p.s I only ask because i don't see anything that really combats the Telerik advancements in GUI development.



28 November, 2009
Anastasios Stampolidis

This is a  very nice feature.Thanks!

28 November, 2009
Robert Fuchs

Great feature, but snap to text base line is missing :-(

I hope we will see it soon.

30 November, 2009

Nice to see that there's been a lot of work on XtraReports. Just another reason to drop [redacted] altogether!


4 December, 2009

Please login or register to post comments.