How to get the colorGroup for selected item in WinForms ColorPicker?
In the WinForms ColorPicker, you can get the color group for the selected item by using the Picked event handler. The property, ActiveGroup helps to get the color group of the selected item in the ColorPickerUIAdv.
The following code example demonstrates the same.
C#
//The event is raised when the ColorItem is picked. this.colorPickerUIAdv1.Picked += new Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv.ColorPickedEventHandler(colorPickerUIAdv1_Picked); void colorPickerUIAdv1_Picked(object sender, Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv.ColorPickedEventArgs args) { // Gets the color group of the selected item. MessageBoxAdv.Show(this.colorPickerUIAdv1.ActiveGroup.Name, "Selected ColorGroup"); }
VB
'The event is raised when the ColorItem is picked. AddHandler colorPickerUIAdv1.Picked, AddressOf colorPickerUIAdv1_Picked Private Sub colorPickerUIAdv1_Picked(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.ColorPickerUIAdv.ColorPickedEventArgs) ' Gets the color group of the selected item MessageBoxAdv.Show(Me.colorPickerUIAdv1.ActiveGroup.Name, "Selected ColorGroup") End Sub
Figure 1: ColorItem selected on the Theme Colors
Figure 2: ColorItem selected on the Standard Colors
Figure 3: ColorItem selected on the Recent Colors
Sample Links:
Conclusion
I hope you enjoyed learning how get the colorGroup for selected item in WinForms ColorPicker.
You can refer to WinForms Color Picker feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Cuolor Picker example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!