Can I fly high in the Sky?

Never say never.

导航

通过SimpleAction显示一个listview

Posted on 2015-05-06 13:56  lsr_flying  阅读(194)  评论(0编辑  收藏  举报
 1 private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e) {
 2 
 3            IObjectSpace os = Application.CreateObjectSpace();
 4 
 5              string listViewId = Application.FindListViewId(typeof(Contact));
 6 
 7            CollectionSourceBase cs = Application.CreateCollectionSource(os, typeof(Contact), listViewId);
 8 
 9            e.ShowViewParameters.CreatedView = Application.CreateListView( listViewId,cs, true);
10 
11            //Specify various display settings.
12            e.ShowViewParameters.Context = TemplateContext.View;
13            //Determines where to show the ListView;
14            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
15 
16        }