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;
}
}
}
}
}
}