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

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

Property Value

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

.NET Framework Security

See Also

Reference

DataRepeaterItem Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the DataRepeater Control (Visual Studio)