|
| 1 | +--- |
| 2 | +title: How to Hide DockingGuide Indicators |
| 3 | +description: Learn how to hide DockingGuide Indicators that appear in the center and manage their position. |
| 4 | +type: how-to |
| 5 | +page_title: How to Hide DockingGuide Indicators that Appear in Center in RadDock for WinForms |
| 6 | +slug: dock-hide-docking-guide-indicators |
| 7 | +tags: dock, docking, indicator, hints, position, drag, drop |
| 8 | +res_type: kb |
| 9 | +ticketid: 1661136 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +|Product Version|Product|Author| |
| 15 | +|----|----|----| |
| 16 | +|2024.3.806|RadDock for WinForms|[Nadya Todorova](https://www.telerik.com/blogs/author/nadya-karaivanova)| |
| 17 | + |
| 18 | +## Description |
| 19 | + |
| 20 | +By default, when the user starts dragging a window in RadDock, Docking Assistant appears. Docking Assistant uses DockingGuidesTemplates to show hints to help the user to relocate the window. For more information please refer to [Using the DragDropService]({%slug winforms/controls/dock/architecture-and-features/using-the-dragdropservice%}) |
| 21 | + |
| 22 | +>caption Figure 1: Before. |
| 23 | +
|
| 24 | + |
| 25 | + |
| 26 | +A common requirement is to hide some of the docking guide indicators. This article demonstrates how one can manage the docking hints appearance and achieve the look as the image below: |
| 27 | + |
| 28 | +>caption Figure 2: After |
| 29 | +
|
| 30 | + |
| 31 | + |
| 32 | +## Solution |
| 33 | + |
| 34 | +To achieve this, you should handle the **DragDropService.PreviewDockPosition** event of RadDock. **AllowedDockPosition** property gets or sets the allowed dock position for the hit-tested drop target which you can customize and set only the relevant positions for you. |
| 35 | + |
| 36 | +Please refer to the following code snippet: |
| 37 | + |
| 38 | +````C# |
| 39 | + |
| 40 | +DragDropService service = this.radDock1.GetService<DragDropService>(); |
| 41 | +service.PreviewDockPosition += Service_PreviewDockPosition; |
| 42 | + |
| 43 | +private void Service_PreviewDockPosition(object sender, DragDropDockPositionEventArgs e) |
| 44 | +{ |
| 45 | + if (e.GuidePosition == DockingGuidesPosition.Center) |
| 46 | + { |
| 47 | + e.AllowedDockPosition = AllowedDockPosition.None; |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +```` |
| 52 | +````VB.NET |
| 53 | +Dim service As DragDropService = Me.radDock1.GetService(Of DragDropService)() |
| 54 | +AddHandler service.PreviewDockPosition, AddressOf Service_PreviewDockPosition |
| 55 | + |
| 56 | +Private Sub Service_PreviewDockPosition(ByVal sender As Object, ByVal e As DragDropDockPositionEventArgs) |
| 57 | + If e.GuidePosition = DockingGuidesPosition.Center Then |
| 58 | + e.AllowedDockPosition = AllowedDockPosition.None |
| 59 | + End If |
| 60 | + End Sub |
| 61 | + |
| 62 | +```` |
| 63 | + |
| 64 | +>note Feel free to customize further the **AllowedDockPositions** with different options according to your needs. |
| 65 | +
|
| 66 | + |
| 67 | +## See Also |
| 68 | + |
| 69 | +[Using the DragDropService]({%slug winforms/controls/dock/architecture-and-features/using-the-dragdropservice%}) |
| 70 | +[DockingGuidesTemplate]({%slug winforms/controls/dock/architecture-and-features/dockingguidestemplate%}) |
0 commit comments