To do this you have to write a Controller and
inherit it with ShowNavigationItemController
Here There is a Class Shipment when I click on Shipment in NavigationBar then a
PopupListView will Come of DispatchRegister
Now add the code below
protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs args)
{
base.ShowNavigationItem(args);
if ((args.SelectedChoiceActionItem != null) && args.SelectedChoiceActionItem.Enabled)
{
if (args.SelectedChoiceActionItem.Id == "Shipment_ListView")
{
ObjectSpace os = Application.CreateObjectSpace();
DevExpress.ExpressApp.ListView lv = Application.CreateListView(os, typeof(DispatchRegister), true);
args.ShowViewParameters.CreatedView = lv;
args.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
args.ShowViewParameters.CreateAllControllers = true;
DialogController dc = new DialogController();
args.ShowViewParameters.Controllers.Add(dc);
dc.Accepting += new EventHandler
}
}
}
Now Write Code on Accepting Here You Can Find Selected Item after Clicking on OK Button
void dc_Accepting(object sender, DialogControllerAcceptingEventArgs e)
{
ObjectSpace os=Application.CreateObjectSpace ();
ListView lv = ((ListView)((WindowController)sender).Window.View);
Shipment sp = null;
CollectionSource cs = new CollectionSource(os, typeof(Shipment));
CollectionSourceBase cs1 = (CollectionSourceBase)lv.CollectionSource;
foreach (DispatchRegister dr in lv.SelectedObjects)
{
sp = new Shipment(os.Session);
sp.BlockNo = dr.DeliveryNumber;
sp.ChallanNo = dr.DistributionChannel;
cs.Collection.Add(os.GetObject (sp));
}
ListView listView = Application.CreateListView("Shipment_ListView", cs, true);
e.ShowViewParameters.CreatedView = listView;
e.ShowViewParameters.TargetWindow = TargetWindow.Default;
}
No comments:
Post a Comment