0

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

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

编辑:

到目前为止我所拥有的如下所示。在我的一项操作的 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;
        }
    }
4

1 回答 1

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

于 2013-12-20T22:07:46.203 回答