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

How to provide the capability to display a footer at the top of a GridView

$
0
0

The current example illustrates how to customize the default GridView, so that it can display a footer at the top of a view.

Question Comments

Added By: Ty Yanushka at: 7/7/2016 2:24:18 PM    For those of you that may have an horizontal scrollbar, switch out the piece of code below. The change is in the "else" block.

            if (gv.OptionsView.ShowFooter)
            {
                r = ViewRects.Client;
                r.Height = GetFooterPanelHeight();


                if (gv.OptionsView.FooterLocation == FooterPosition.Top)
                {
                    r.Y = minTop;
                    ViewRects.Footer = r;
                    minTop = ViewRects.Footer.Bottom;
                }
                else
                {
                    r.Y = maxBottom - r.Height;
                    ViewRects.Footer = r;
                    maxBottom = r.Top;
                }
            }

With:

            if (gv.OptionsView.ShowFooter)
            {
                r = ViewRects.Client;
                r.Height = GetFooterPanelHeight();


                if (gv.OptionsView.FooterLocation == FooterLocation.Top)
                {
                    r.Y = minTop;
                    ViewRects.Footer = r;
                    minTop = ViewRects.Footer.Bottom;
                }
                else
                {
                    var scrollAdjust = 0;
                    if (HScrollBarPresence == ScrollBarPresence.Visible)
                    {
                        scrollAdjust = HScrollSize;
                    }
                    r.Y = maxBottom - r.Height - scrollAdjust;
                    ViewRects.Footer = r;
                    maxBottom = r.Top;
                }
            }


Added By: Ty Yanushka at: 7/7/2016 2:26:37 PM    Sorry, to explain, that's because if you change the columns in the original example to create the situation where a horizontal scrollbar is present, the footer (when at the bottom) will show up under the scrollbar. This change fixes that.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



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