首页 > 代码库 > XAF ListView 移除顶部工具栏
XAF ListView 移除顶部工具栏
此方法适用于C/S及B/S,无需分别写在web和win中。
Module下新建ViewController,代码如下:
public partial class GongZuoJiaoShen_YinCangGongJuLan : ViewController<DetailView> { public GongZuoJiaoShen_YinCangGongJuLan() { InitializeComponent(); // Target required Views (via the TargetXXX properties) and create their Actions. } protected override void OnActivated() { base.OnActivated(); // Perform various tasks depending on the target View. //取消记录表的工具栏 foreach (ListPropertyEditor detailPropertyEditor in View.GetItems<ListPropertyEditor>()) { if (detailPropertyEditor.Id == "JiaoShenJiLu") detailPropertyEditor.ControlCreated += new EventHandler<EventArgs>(detailPropertyEditor_ControlCreated); } } /// <summary> /// 取消记录表的工具栏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void detailPropertyEditor_ControlCreated(object sender, EventArgs e) { Frame nestedFrame = ((ListPropertyEditor)sender).Frame; if (nestedFrame != null && nestedFrame.Template is ISupportActionsToolbarVisibility) { ((ISupportActionsToolbarVisibility)nestedFrame.Template).SetVisible(false); } } 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(); foreach (ListPropertyEditor detailPropertyEditor in View.GetItems<ListPropertyEditor>()) { if (detailPropertyEditor.Id == "JiaoShenJiLu") detailPropertyEditor.ControlCreated -= new EventHandler<EventArgs>(detailPropertyEditor_ControlCreated); } } }
注意:VC的TargetType要设置,否则就是全局的了。
效果图:
XAF ListView 移除顶部工具栏
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。