在所有现有ListView上显示页脚

时间:2013-12-20 21:26:22

标签: c# devexpress devexpress-windows-ui

有没有办法让页脚在ListView上自动显示?我正在处理的应用程序有大约40-50个ListView,并且在设计器中检查每个ListView并检查“IsFooterVisible”是不方便的。更不用说我想要新创建的ListView来显示页脚。

我正在使用DevExpress XAF v 13. * for Windows UI。

编辑:

到目前为止,我的内容如下所示。在我的一个动作的ViewControlsCreated事件中,我尝试使页脚可见:

    private void SummarizeGridDataController_ViewControlsCreated(object sender, EventArgs e)
    {
        var listView = this.View as ListView;

        if (listView != null)
        {
            GridControl grid = (GridControl)View.Control;
            GridView view = (GridView)grid.FocusedView;
            view.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
        }
    }

1 个答案:

答案 0 :(得分:1)

我添加了一个为ListView运行的控制器。创建控件后,我将页脚可见性设置为true:

    public partial class WinShowFooterController : ViewController<ListView>
{
    public WinShowFooterController()
    {
        InitializeComponent();
        RegisterActions(components);
        // Target required Views (via the TargetXXX properties) and create their Actions.
    }

    protected override void OnViewControlsCreated()
    {
        base.OnViewControlsCreated();
        // Access and customize the target View control.
    }

    protected override void OnActivated()
    {
        base.OnActivated();

        bool shouldSetFooterToVisible = this.View != null && this.View.Model != null;

        if (shouldSetFooterToVisible)
        {
            this.View.Model.IsFooterVisible = true;
        }
    }

    protected override void OnDeactivated()
    {
        base.OnDeactivated();
    }
}

上面的代码是通过DevExpress支持提供的:https://www.devexpress.com/Support/Center/Question/Details/Q558578