Add a new button to the C1DockControl

Posted by: rambabu on 8 September 2023, 7:33 am EST

    • Post Options:
    • Link

    Posted 8 September 2023, 7:33 am EST - Updated 8 September 2023, 7:39 am EST

    Hello,

    I am looking to add a new button to the componentone DockControl.

    Can you please let me know how to do that?

    Thanks & Regards

  • Posted 10 September 2023, 8:53 pm EST

    Hi,

    You can add a button on DockTabControl’s Header by handling Loaded event as:(see code snippet)

     private void DockControl_Loaded(object sender, RoutedEventArgs e)
            {
                var stackPanel = dockTab.Template.FindName("StackPanelButtons",dockTab) as StackPanel;
                var border1 = new Border();
                var btn1 = new Button() { Width = 15, Height = 15, Background = Brushes.Transparent, BorderBrush = Brushes.Transparent, Content = new C1PathIcon() { Data = "M10,19H13V22H10V19M12,2C17.35,2.22 19.68,7.62 16.5,11.67C15.67,12.67 14.33,13.33 13.67,14.17C13,15 13,16 13,17H10C10,15.33 10,13.92 10.67,12.92C11.33,11.92 12.67,11.33 13.5,10.67C15.92,8.43 15.32,5.26 12,5A3,3 0 0,0 9,8H6A6,6 0 0,1 12,2Z" } };
                btn1.Click += (s1, e1) =>
                {
                    MessageBox.Show("This is a Tab Control.");
                };
                border1.Child = btn1;
                stackPanel.Children.Add(border1);            
            }

    Please refer the attached sample for the same: CustomizeDockTabIcon.zip

    Best Regards,

    Nitin

  • Posted 11 September 2023, 1:07 am EST

    Thank you Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels