Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

Use only one scroll bar for a grid with multiple master/detail levels.

$
0
0

A grid containing a number of groups (master), each with a number of lines (detail) is a representation of an order which is grouped for readability. When a group has a greater number of lines then fits on the screen, a scrollbar is added to the detail-view and when there are multiple groups the master-view also gets a scrollbar. When the user scrolls through the grid, only the master-view is scrolled (unless a row is selected, then only the detail-view is scrolled) and it feels like the program is behaving oddly, as half the rows are skipped.

To achieve this goal, we need the GridControl to have a height equal to the height of all content placed in a master-view. So, the scrollbar does not appear in either the master-view or in the detail-view. To allow scrolling, we need to put our GridControl into a XtraScrollableControl and set the GridControl.Dock property to DockStyle.Top.

We created the MyGridControl class - a descendant of the GridControl. MyGridControl works with MyGridView views and includes the CalcGridHeight() method, which is called when the appearance of the Master-View is changed.

To put MyGridControl in the XtraScrollableContainer, use the MyGridControl.InitScrolling method at runtime. Use the MyGridControl.InitScrollingInLayout method to initialize scrolling in a LayoutControlItem. 

Please note that if you want to change Bounds or Dock properties of MyGridControl at runtime, change similar properties of the MyGridControl.ScrollableContainer control.

Question Comments

Added By: Pascal Veilleux (Seika) at: 11/26/2012 7:29:29 PM    

The solution works great except that with that solution, since the XtraScrollableContainer contains the whole grid, we loose the header when we scroll so the user must scroll to the top to be able to sort, group, ...

Added By: Stécy at: 5/9/2014 6:14:11 AM    

Does not work if the grid is inside a layout control. How to fix?

Added By: Ekaterina (DevExpress Support) at: 5/11/2014 11:24:18 PM    Hi,

I've created the The 'Use only one scroll bar for a grid with multiple master/detail levels.' example doesn't work when a grid is inside a LayoutControl ticket. Let's discuss the issue related to LayoutControl there.

Added By: Steven Haworth (Visy) at: 7/28/2014 4:16:25 PM    

I have found that this control will crash with an "Overflow Error" Exception when using the Zoom functionality on 14.1.5.

Setting Master_GridView.OptionsDetail.AllowZoomDetail to false will make it crash when you click on the zoom button - even though it does not have the zoom glyph.

Setting Master_GridView.OptionsDetail.AllowZoomDetail to true, zooming the detail works, but restoring it back will crash it.

You can fix this by clearing the code in the MyGridView.ZoomView override but I don't know how to fix if you do want zoom functionality.

Added By: Alisher (DevExpress Support) at: 7/29/2014 12:09:42 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T134620: Overflow Error exception occurs when using Zoom functionality in the E4376 example. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>