DataRepeaterItem.IsCurrent 屬性
取得值,這個值決定 DataRepeaterItem 是否為 DataRepeater 控制項中目前選取的項目。
命名空間: 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 with get
function get IsCurrent () : boolean
屬性值
類型:Boolean
如果 DataRepeaterItem 為目前選取的項目,則為 true,否則為 false。
備註
當 IsCurrent 等於 True時, DataRepeaterItem 的 ItemIndex 屬性與 DataRepeater 控制項的 CurrentItemIndex 屬性。
範例
當項目被選取時,下列範例示範如何使用 DrawItem 事件處理常式會顯示選取指示器。 它假設您有一份表單,其中包含已繫結的 DataRepeater 具名 DataRepeater1 也包含未繫結的 PictureBox 控制項名為 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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間