C# 使页脚在所有现有ListView上可见
有没有办法使页脚在ListView上自动可见?我正在处理的应用程序大约有40-50个ListView,在设计器中查看每个ListView并选中“IsFooterVisible”很不方便。更不用说我希望新创建的ListView显示页脚 我正在为Windows UI使用DevExpress XAF v 13.* 编辑: 到目前为止,我所了解的情况如下所示。在我的一个操作的ViewControlsCreated事件中,我尝试使页脚可见:C# 使页脚在所有现有ListView上可见,c#,devexpress,devexpress-windows-ui,C#,Devexpress,Devexpress Windows Ui,有没有办法使页脚在ListView上自动可见?我正在处理的应用程序大约有40-50个ListView,在设计器中查看每个ListView并选中“IsFooterVisible”很不方便。更不用说我希望新创建的ListView显示页脚 我正在为Windows UI使用DevExpress XAF v 13.* 编辑: 到目前为止,我所了解的情况如下所示。在我的一个操作的ViewControlsCreated事件中,我尝试使页脚可见: private void SummarizeGridDa
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;
}
}
我添加了一个为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();
}
}
公共部分类WinShowFooterController:ViewController
{
公共WinShowFooterController()
{
初始化组件();
注册操作(组件);
//以所需视图为目标(通过TargetXXX属性)并创建其操作。
}
受保护的覆盖无效OnViewControlsCreated()
{
base.OnViewControlsCreated();
//访问和自定义目标视图控件。
}
已激活的受保护覆盖无效()
{
base.OnActivated();
bool shouldSetFooterToVisible=this.View!=null&&this.View.Model!=null;
if(shouldSetFooterToVisible)
{
this.View.Model.IsFooterVisible=true;
}
}
受保护的覆盖已激活()
{
base.com()激活;
}
}
上面的代码是通过DevExpress支持从帮助中提供的:
查看设计器中的每个列表视图并选中“IsFooterVisible”是不方便的,但是计算机很容易在一个循环中完成。