Used by the DataRepeater control to display data at run time.
Assembly: Microsoft.VisualBasic.PowerPacks (in Microsoft.VisualBasic.PowerPacks.dll)
The DataRepeater control uses objects to display each item in the control as it is scrolled into view. As soon as an item is scrolled out of view, the is invalidated and replaced by a new for the next visible item.
You should modify only the DrawItem event. Attempting to modify it outside the event or trying to create a new can produce unexpected results.that can be accessed from the
The following example demonstrates how to use the DrawItem event handler to make changes when an item is scrolled into view. This example assumes that you have a DataRepeater control that is bound to the Products table in the Northwind database.
Private Sub DataRepeater1_DrawItem(ByVal sender As Object, ByVal e _ As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) _ Handles DataRepeater1.DrawItem ' Alternate the back color. If (e.DataRepeaterItem.ItemIndex Mod 2) <> 0 Then ' Apply the secondary back color. e.DataRepeaterItem.BackColor = Color.AliceBlue Else ' Apply the default back color. DataRepeater1.ItemTemplate.BackColor = Color.White End If ' Change the color of out-of-stock items to red. If e.DataRepeaterItem.Controls(UnitsInStockTextBox.Name).Text _ < 1 Then e.DataRepeaterItem.Controls(UnitsInStockTextBox.Name). _ BackColor = Color.Red Else e.DataRepeaterItem.Controls(UnitsInStockTextBox.Name). _ BackColor = Color.White End If End Sub