DataRepeaterItem.IsCurrent プロパティ

DataRepeaterItemDataRepeater のコントロールで現在選択されている項目であるかどうかを示す値を取得します。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
<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

プロパティ値

型 : System.Boolean
DataRepeaterItem が現在選択されている項目である true ; それ以外 false。

解説

IsCurrent が True になると、DataRepeaterItemItemIndex のプロパティは DataRepeater コントロールの CurrentItemIndex のプロパティと同じです。

項目を選択すると、次の例の選択インジケーターを表示するために DrawItem のイベント ハンドラーを使用する方法を示します。DataRepeater1 という名前のバインド DataRepeater を含むフォームはです SelectedPictureBox、という名前の PictureBox の非バインド コントロールが含まれています。

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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

DataRepeaterItem クラス

Microsoft.VisualBasic.PowerPacks 名前空間

その他の技術情報

DataRepeater コントロールの概要 (Visual Studio)