Friday, December 11, 2009

How To Find Top 10 Record in ListView in XAF

if (View is ListView && View.ObjectTypeInfo.Type == typeof(GroupWiseMasterDailyLedger))
{
ListView lv = (ListView)View;
XPCollection XPC =(XPCollection) lv.CollectionSource.Collection;
SortingCollection sc = new SortingCollection(); sc.Add(new SortProperty("Debit", DevExpress.Xpo.DB.SortingDirection.Descending));
XPC.Sorting = sc;
XPC.TopReturnedObjects = 5;
}

How To Add Search Option on Lookup

[LookupEditorMode(LookupEditorMode.AllItemsWithSearch)] Apply this Attribute on lookup

How To Apply Clock and Date on Your Application

To apply A Clock on Your Application You have To add A SimpleAction Take A controller and Add a SimpleAction Now Write Code void View_ControlsCreated(object sender, EventArgs e) { if (View is ListView) { System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer(); tmr.Enabled = true; tmr.Start(); tmr.Tick += new EventHandler(tmr_Tick); } } void tmr_Tick(object sender, EventArgs e) { SimpleAction1.Caption = DateTime.Now.ToString(); }

Display Format for Timespan in C#

EditMask {0:HH:mm}

EditMask HH:mm

Set the mask so the user can enter a phone number, with optional area code, and a state in capitals.this.c1TrueDBGrid.Columns[0].EditMask = "(###) 000-0000 St\ate\: >LL";

$#,##0.00;($#,##0.00) Currency format.

0 Fixed number format.

#,##0 Commas format.

0% Percent format.

0.00E+00 Scientific format.

c General Date and Time format.

dddddd Long Date format.

dd-mmm-yy Medium Date format.

ddddd Short Date format.

ttttt Long Time format.

hh:mm AM/PM Medium Time format.

hh:mm Short Time format.

How To Change Grid into VerticalGrid

Assembly : DevExpress.XtraVerticalGrid;
:DevExpress.XtraGrid;

void View_ControlsCreated(object sender, EventArgs e)
{
ListView LV=(ListView)View;
GridControl GD = (GridControl)LV.Editor.Control;
VGridControl VG = new VGridControl(); VG.DataSource = LV.CollectionSource.Collection;
GD.Controls.Add (VG);
VG.AllowDrop = true;
VG.Dock = System.Windows.Forms.DockStyle.Fill;
VG.Appearance.FocusedRow.BackColor = System.Drawing.Color.Red;
VG.AllowDrop = true;
VG.LayoutStyle = LayoutViewStyle.MultiRecordView;
System.Drawing.Size sz = new System.Drawing.Size(1500, 1500);
VG.Size = sz;
VG.OptionsBehavior.AutoFocusNewRecord = true;
VG.OptionsBehavior.Editable = true;
VG.OptionsBehavior.RecordsMouseWheel = true;
VG.OptionsView.AutoScaleBands = true;
VG.OptionsView.ShowButtons = true;
}

How to Check That Interface is implemented in the Class

if (View is DetailView && View.ObjectTypeInfo.Implements<"ILedger>"()){} here Plz Do not Apply Double quotes before/after ILedger

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;
}

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...