DataRepeater.SelectionColorChanged Event

 

Occurs when the SelectionColor property is changed.

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

Syntax

public event EventHandler SelectionColorChanged
public:
event EventHandler^ SelectionColorChanged {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
}
member SelectionColorChanged : IEvent<EventHandler,
    EventArgs>
Public Event SelectionColorChanged As EventHandler

Remarks

Use this event to run code when the SelectionColor property of an item header is changed at run time.

For more information about how to handle events, see Handling and Raising Events.

Examples

The following example demonstrates how to respond to the SelectionColorChanged event.

private void dataRepeater1_SelectionColorChanged(object sender, System.EventArgs e)
{
    StringBuilder MyStringBuilder = new StringBuilder(dataRepeater1.SelectionColor.ToString());
    string searchWithinThis = dataRepeater1.SelectionColor.ToString();
    // Find the color name.
    string searchForThis = "[";
    int firstCharacter = searchWithinThis.IndexOf(searchForThis);
    MyStringBuilder.Remove(0, firstCharacter + 1);
    MyStringBuilder.Replace(']', ' ');

    // Display a message.
    MessageBox.Show("Selections will be indicated by a " + MyStringBuilder + "header.");
}
Private Sub DataRepeater1_SelectionColorChanged(
  ) Handles DataRepeater1.SelectionColorChanged
    Dim ColorString As String = DataRepeater1.SelectionColor.ToString
    Dim BracketPosition As Integer
    ' Find the left bracket.
    BracketPosition = InStr(ColorString, "[")
    ' Find the color name.
    ColorString = Microsoft.VisualBasic.Right(ColorString, 
     Len(ColorString) - BracketPosition)
    ColorString = Microsoft.VisualBasic.Left(ColorString, 
     Len(ColorString) - 1)
    ' Display a message.
    MsgBox("Selections will be indicated by a " & ColorString &
       " header.")
End Sub

See Also

SelectionColor
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)

Return to top