GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : VirtualMode Property |
<DefaultValueAttribute()> <FeatureAttribute(Name="VirtualMode", Version="v5.0")> <SRDescriptionAttribute("Indicates whether the user has provided their own data-management operations for the GcMultiRow control. ")> <SRCategoryAttribute("Behavior")> Public Property VirtualMode As Boolean
Dim instance As GcMultiRow Dim value As Boolean instance.VirtualMode = value value = instance.VirtualMode
[DefaultValue()] [Feature(Name="VirtualMode", Version="v5.0")] [SRDescription("Indicates whether the user has provided their own data-management operations for the GcMultiRow control. ")] [SRCategory("Behavior")] public bool VirtualMode {get; set;}
Virtual mode is designed for use with very large stores of data. When the VirtualMode property is true, you create a GcMultiRow control with a set number of rows, and then handle the CellValueNeeded event to populate the cells. Virtual mode requires implementation of an underlying data cache to handle the population, editing, and deletion of GcMultiRow cells based on user actions.
Depending on the code, this may improve the data access performance in GcMultiRow.
The following table lists the related virtual mode events.
Event | Description |
---|---|
CellValueNeeded | The control fires this event when a value is required from the data such as when the control needs to paint a cell or some other action that requires a cell value. You should handle this event and set the CellValueEventArgs.Value property to a specific value that maps to your data store based on the CellEventArgs.SectionIndex (or CellEventArgs.RowIndex), the CellEventArgs.CellIndex (or CellEventArgs.CellName), and the CellEventArgs.Scope. |
CellValuePushed | The control fires this event to notify you that a specific cell value has changed such as when the user edits a cell value and commits the edited value. Handle this event to update your data store. The new value information is contained in the CellValueEventArgs.Value property. To locate the cell which has been edited, get the CellEventArgs.SectionIndex (or CellEventArgs.RowIndex), the CellEventArgs.CellIndex (or CellEventArgs.CellName), and the CellEventArgs.Scope in the CellValueEventArgs. |
NewRowNeeded | This event is optional. If you want to automatically generate values when the current cell is in an uncommitted new row like a database, you need to handle this event.Handle this event, and then change the value of the cells in the RowEventArgs.Row of the RowEventArgs. |
- and - |
These two events are optional. You only need to handle these two events if you want to implement a row level commit. When the user presses the Esc key to cancel the current row's uncommitted edit, the control fires the CancelRowEdit event to notify you to restore the data store's value. Handle RowDirtyStateNeeded to decide the current IsCurrentRowDirty property value. This property's value must be true before the CancelRowEdit event can be fired. |
This property is invalid when GcMultiRow is in data binding mode.
public class VirtualModeDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private List<Student> userData = new List<Student>(); private Student uncommitNewStudent = null; private Student restoreRow = null; public VirtualModeDemo() { this.Text = "VirtualMode Demo"; // Add MultiRow to form this.gcMultiRow1.Dock = DockStyle.Fill; this.Controls.Add(this.gcMultiRow1); this.InitializeTemplate(); this.InitializeData(); this.Load += new EventHandler(Form1_Load); } private void Form1_Load(object sender, EventArgs e) { // Set virtual mode event, manage date using CellValueNeeded, CellValuePushed, etc. events. gcMultiRow1.VirtualMode = true; gcMultiRow1.CellValueNeeded += new EventHandler<CellValueEventArgs>(gcMultiRow1_CellValueNeeded); gcMultiRow1.CellValuePushed += new EventHandler<CellValueEventArgs>(gcMultiRow1_CellValuePushed); gcMultiRow1.CancelRowEdit += new EventHandler<QuestionEventArgs>(gcMultiRow1_CancelRowEdit); gcMultiRow1.NewRowNeeded += new EventHandler<RowEventArgs>(gcMultiRow1_NewRowNeeded); gcMultiRow1.RowEnter += new EventHandler<CellEventArgs>(gcMultiRow1_RowEnter); gcMultiRow1.RowsAdded += new EventHandler<RowsAddedEventArgs>(gcMultiRow1_RowsAdded); gcMultiRow1.RowsRemoved += new EventHandler<RowsRemovedEventArgs>(gcMultiRow1_RowsRemoved); }
Public Class VirtualModeDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private userData As New List(Of Student)() Private uncommitNewStudent As Student = Nothing Private restoreRow As Student = Nothing Public Sub New() Me.Text = "VirtualMode Demo" ' Add MultiRow to form Me.gcMultiRow1.Dock = DockStyle.Fill Me.Controls.Add(Me.gcMultiRow1) Me.InitializeTemplate() Me.InitializeData() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load ' Set virtual mode event, manage date using CellValueNeeded, CellValuePushed etc. events. gcMultiRow1.VirtualMode = True End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2