Ads 468x60px

Wednesday, April 11, 2012

XAF : Override ListView Default Action

In order to override list view default action, you should do the following
  1. Add view controller to your project [i.e. ListViewActionsController]
  2. make class (ListViewActionsController) inherit from DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController
  3. Override the function.[i.e. ProcessCurrentObject].
The following example present an example for this:

   1:  Imports System
   2:  Imports System.ComponentModel
   3:  Imports System.Collections.Generic
   4:  Imports System.Diagnostics
   5:  Imports System.Text
   6:   
   7:  Imports DevExpress.ExpressApp
   8:  Imports DevExpress.ExpressApp.Actions
   9:  Imports DevExpress.Persistent.Base
  10:   
  11:  Public Class ListViewActionsController Inherits
  12:  DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController
  13:   
  14:      Public Shared usrname As String
  15:      Public Sub New()
  16:          MyBase.New()
  17:   
  18:          'This call is required by the Component Designer.
  19:          InitializeComponent()
  20:          RegisterActions(components)
  21:   
  22:      End Sub
  23:   
  24:      Protected Overrides Sub ProcessCurrentObject(ByVal e As 
               DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs)
  25:          If (e.CurrentObject.GetType.Name = "PhoneHolder" And 
                       View.Id = "CustomHolderListView") Then        
  26:              BillingSystem.Module.sharedMod.currentClickedUsername = 
                                   CType(e.CurrentObject, PhoneHolder).UserName
  27:          End If
  28:   
  29:          MyBase.ProcessCurrentObject(e)
  30:      End Sub
  31:   
  32:  End Class

No comments:

Post a Comment