zoukankan      html  css  js  c++  java
  • [XAF]如何在非按钮事件中打开视图

     1  private static void OpenDetailView(XafApplication app) {
     2             IObjectSpace os = app.CreateObjectSpace();
     3             //Find an existing object.
     4             //Contact obj = os.FindObject<Contact>(CriteriaOperator.Parse("FirstName=?", "My Contact"));
     5             //Or create a new object.
     6             Contact obj = os.CreateObject<Contact>();
     7             obj.FirstName = "My Contact";
     8             //Save the changes if necessary.
     9             //os.CommitChanges();
    10             //Configure how our View will be displayed (all parameters except for the CreatedView are optional).
    11             ShowViewParameters svp = new ShowViewParameters();
    12             svp.CreatedView = app.CreateDetailView(os, obj);
    13             //svp.TargetWindow = TargetWindow.NewModalWindow;
    14             //svp.Context = TemplateContext.PopupWindow;
    15             //svp.CreateAllControllers = true;
    16             //You can pass custom Controllers for intercommunication or to provide a standard functionality (e.g., functionality of a dialog window).
    17             //DialogController dc = Application.CreateController<DialogController>();
    18             //svp.Controllers.Add(dc);
    19             // Show our View once the ShowViewParameters object is initialized.
    20             app.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
    21         }

    另外一种方法,

    1 ShowViewParameters svp = new ShowViewParameters();
    2 ViewShortcut shortcut = new ViewShortcut(Application.FindDetailViewId(typeof(Contact)), obj.Oid);
    3 svp.CreatedView = Application.ProcessShortcut(shortcut);
  • 相关阅读:
    SharePoint 2010 获取当前用户的权限
    SharePoint 2010 移除Ribbon菜单中的命令项
    SqlServer2000孤立用户解决方案
    Hello Go!
    XMLHttpRequest对象介绍——1
    Struts 2 简单配置
    asp.net 2.0热贴收藏
    .NET牛人应该知道些什么(转)?
    ASP.net 2.0 中 WebResource.axd 管理资源的一些知识点
    asp.net中的异步页面
  • 原文地址:https://www.cnblogs.com/lsr-flying/p/4508708.html
Copyright © 2011-2022 走看看