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

public Color SelectionColor { get; set; }
public:
property Color SelectionColor {
    Color get();
    void set(Color value);
}
member SelectionColor : Color with get, set
Public Property SelectionColor As 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 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;
    }
}
Private Sub DataRepeater1_LayoutStyleChanged(
    ) 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

See Also

ItemHeaderVisible
ItemHeaderSize
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
How to: Display Item Headers in a DataRepeater Control (Visual Studio)

Return to top