Friday, December 11, 2009

Open Popup ListView of any Class on Navigation Click

If You Want To Open a PopupListView on Navigation Click
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(dc_Accepting);
}
}
}

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

Mat Table Angular

Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...