Posted 8 August 2023, 9:35 am EST - Updated 8 August 2023, 9:40 am EST
How to change the color of the dock icons in Componentone C1DockTabControl
Posted by: rambabu on 8 August 2023, 9:35 am EST
-
-
Posted 9 August 2023, 2:21 am EST
Hi Rambabu,
You can fetch the C1DockTabControl icons by handling DockControl’s ViewChanged event. Th following code shows how to changed the backcolor of these buttons:
private void DockControl_ViewChanged(object? sender, EventArgs e) { var dockControl = sender as C1DockControl; if (dockControl != null) { List<C1DockTabControl> tabControls = GetAllC1DockTabControls(dockControl.Items); foreach (var tabControl in tabControls) { var dropDownButton = (tabControl.Template.FindName("9_T", tabControl) as C1DropDownButton); dropDownButton.Background = Brushes.Yellow; var pinButton = (tabControl.Template.FindName("SlidingButton", tabControl) as Button); pinButton.Background = Brushes.Yellow; var closeButton = (tabControl.Template.FindName("HiddenButton", tabControl) as Button); closeButton.Background = Brushes.Yellow; } } } public static List<C1DockTabControl> GetAllC1DockTabControls(ItemCollection items) { List<C1DockTabControl> tabControls = new List<C1DockTabControl>(); foreach (var item in items) { if (item is C1DockTabControl tabControl) { tabControls.Add(tabControl); } else if (item is C1DockGroup dockGroup) { // Recursively call the function for C1DockGroup's items tabControls.AddRange(GetAllC1DockTabControls(dockGroup.Items)); } } return tabControls; }
You can further explore the properties of these buttons and customize them as per your requirements. Kindly refer to the attached sample for full implementation. ( CustomizeDockTabIcon.zip )
Thanks & Regards,
Aastha -
Posted 9 August 2023, 9:04 am EST
Thank you, Aastha