DataRepeater.SelectionColor Property

Gets or sets the color that is displayed in the item header of a DataRepeater control when an item is first selected.

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

Syntax

'Declaration
Public Property SelectionColor As Color
'Usage
Dim instance As DataRepeater 
Dim value As Color 

value = instance.SelectionColor

instance.SelectionColor = value
public Color SelectionColor { get; set; }
public:
property Color SelectionColor {
    Color get ();
    void set (Color value);
}
public function get SelectionColor () : Color 
public function set SelectionColor (value : Color)

Property Value

Type: System.Drawing.Color
The color to use. The default is Highlight.

Remarks

The SelectionColor is applied only when a DataRepeaterItem has focus. When a control in the item has focus, the item header color will be the same as the BackColor.

Note

If you set the SelectionColor to White, the selection symbol is not visible when the item is selected.

Examples

The following example demonstrates how to change the selection color in response to a change in layout.

Private Sub DataRepeater1_LayoutStyleChanged(ByVal sender As Object, _
 ByVal e As System.EventArgs) Handles DataRepeater1.LayoutStyleChanged
    ' Set the SelectionColor based on orientation. 
    If DataRepeater1.LayoutStyle = _
     PowerPacks.DataRepeaterLayoutStyles.Vertical Then
        DataRepeater1.SelectionColor = Drawing.Color.Blue
    Else
        DataRepeater1.SelectionColor = Drawing.Color.Red
    End If 
End Sub
private void dataRepeater1_LayoutStyleChanged(object sender, System.EventArgs e)
{
    // Set the SelectionColor based on orientation. 
    if (dataRepeater1.LayoutStyle == DataRepeaterLayoutStyles.Vertical)
    {
        dataRepeater1.SelectionColor = System.Drawing.Color.Blue;
    }
    else
    {
        dataRepeater1.SelectionColor = System.Drawing.Color.Red;
    }
}

.NET Framework Security

See Also

Reference

DataRepeater Class

DataRepeater Members

Microsoft.VisualBasic.PowerPacks Namespace

ItemHeaderVisible

ItemHeaderSize

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

How to: Display Item Headers in a DataRepeater Control (Visual Studio)