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)

public Color SelectionColor { get; set; }

Property Value

Type: System.Drawing.Color

The color to use. The default is Highlight.

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.


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

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;
        dataRepeater1.SelectionColor = System.Drawing.Color.Red;
Return to top