Ticket Q558578
Visible to All Users

Is there a better way to show the footer/summary for a ListView other than how I'm doing it

created 11 years ago

Hello,
Below is the code in a Action that I'm running to show the Summary options in a footer for ListViews in my application. The code below will will always make a GridView show their footer, which automatically has the summarizing capability in my XAF window's application.
Is there a better way than this? Setting the IsFooterVisible property on a ListView doesn't do it.

C#
public partial class ShowFooterController : ViewController { public ShowFooterController() { InitializeComponent(); RegisterActions(components); // Target required Views (via the TargetXXX properties) and create their Actions. } protected override void OnAfterConstruction() { base.OnAfterConstruction(); } protected override void OnActivated() { base.OnActivated(); this.ViewControlsCreated += SummarizeGridDataController_ViewControlsCreated; // Perform various tasks depending on the target View. } protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); // Access and customize the target View control. } protected override void OnDeactivated() { // Unsubscribe from previously subscribed events and release other references and resources. base.OnDeactivated(); this.ViewControlsCreated -= SummarizeGridDataController_ViewControlsCreated; } private void SummarizeGridDataController_ViewControlsCreated(object sender, EventArgs e) { var listView = this.View as ListView; if (listView != null) { GridControl grid = (GridControl)View.Control; if (grid != null) { foreach (var view in grid.Views) { GridView gridView = view as GridView; if (gridView != null) { gridView.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways; gridView.OptionsView.ShowFooter = true; } } } } } }

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hello,
The following controll works fine on my side

C#
public class Class1:ViewController<ListView>{ protected override void OnActivated(){ base.OnActivated(); View.Model.IsFooterVisible = true; } }
    Comments (2)

      This is much simpler, thank you.

      Dennis Garavsky (DevExpress) 11 years ago

        @Iwan:
        Take special note that this code will automatically force these options to be stored in the user model differences (e.g., in the Model.User.XAFML) file. So, an alternative solution would be to apply these customizations at the Application Model level directly using the built-in ModelViewsNodesGenerator class that enables you to iterate through all auto-generated Views nodes and set defaults for them.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.