Share via


DataRepeaterItem.IsCurrent Property

 

Gets a value that determines whether a DataRepeaterItem is the currently selected item in a DataRepeater control.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

[BrowsableAttribute(false)]
public bool IsCurrent { get; }
public:
[BrowsableAttribute(false)]
property bool IsCurrent {
    bool get();
}
[<BrowsableAttribute(false)>]
member IsCurrent : bool with get
<BrowsableAttribute(False)>
Public ReadOnly Property IsCurrent As Boolean

Property Value

Type: System.Boolean

true if the DataRepeaterItem is the currently selected item; otherwise, false.

Remarks

When IsCurrent equals True, the ItemIndex property of the DataRepeaterItem is the same as the CurrentItemIndex property of the DataRepeater control.

Examples

The following example demonstrates how to use the DrawItem event handler to display a selection indicator when an item is selected. It assumes that you have a form that contains a bound DataRepeater named DataRepeater1 that also contains an unbound PictureBox control named SelectedPictureBox.

private void dataRepeater1_DrawItem(object sender, 
    Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs e)
{
    // If this is the selected item...
    if (e.DataRepeaterItem.IsCurrent)
    // ...display the PictureBox.
    {
        e.DataRepeaterItem.Controls["selectedPictureBox"].Visible = true;
    }
    else
    {
        // Otherwise, hide the PictureBox.
        e.DataRepeaterItem.Controls["selectedPictureBox"].Visible = false;
    }
}
Private Sub DataRepeater1_DrawItem(
    ByVal sender As Object, 
    ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs
  ) Handles DataRepeater1.DrawItem

    ' If this is the selected item.
    If e.DataRepeaterItem.IsCurrent Then
        ' ...display the PictureBox.
        e.DataRepeaterItem.Controls("SelectedPictureBox"). 
         Visible = True
    Else
        ' Otherwise, hide the PictureBox.
        e.DataRepeaterItem.Controls("SelectedPictureBox"). 
         Visible = False
    End If
End Sub

See Also

DataRepeaterItem Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)

Return to top