Category / Section
How to remove the close button in DockingManager?
1 min read
In DockingManager, you can customize the Close button appearance using the following options.
- By using “CloseEnabled” property.
- By removing Close button from CaptionButtonCollection
The following code example demonstrates the same.
C#
//Option 1 private void SetCaptionBtnOptions() { //Hide the CloseButton for all the Controls that are DockEnabled. for (int i = 0; i < this._dockingMgr.CaptionButtons.Count; i++) { if (this._dockingMgr.CaptionButtons[i].Name == "CloseButton") { this._dockingMgr.CaptionButtons.RemoveAt(i); } } } //Option 2 //Hide the CloseButton for all the Controls that are DockEnabled this.dockingManager1.CloseEnabled = false;
VB
'Option 1 Private Sub SetCaptionBtnOptions() 'Hide the CloseButton for all the Controls that are DockEnabled. Dim i As Integer = 0 Do While i < Me.dockingManager1.CaptionButtons.Count If Me.dockingManager1.CaptionButtons(i).Name = "CloseButton" Then Me.dockingManager1.CaptionButtons.RemoveAt(i) End If i += 1 Loop End Sub 'Option 2 'Hide the CloseButton for all the Controls that are DockEnabled. this.dockingManager1.CloseEnabled = false;
The following screenshots illustrates the output.
Figure 1: Close Button removed in Floating controls
Figure 2: Close Button removed in docked controls
Sample
https://www.syncfusion.com/downloads/support/directtrac/general/HideCloseButton-368947012.zip