ToolWindow (ToolTabStrip???) and same issue with DocumentWindow (DocumentTabStrip???)

1 Answer 12 Views
Dock
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Curtis asked on 20 May 2025, 08:44 PM

I've been trying to crack this nut for years without resolution.  It's come full circle back to my desk so I'm once more exploring how to resolve this - I ask this question after hours of trying to find something inside the chain of objects that is RadDock with zero success and here's the worst part, it's such an obvious UI element that I'm shocked I've not been able to locate anything that might be the cause while in "Edit UI Elements"

ANY suggestions or hints is very appreciated!!

Here's the problem:

Adding control to ToolWindow and setting that control's .Dock property = Fill, the control DOES NOT FILL the entire available ToolWindow space.

*NOTE* I'm calling it "ToolWindow's Space" because I think that's what's doing it but IT MIGHT BE THE PARENT, "ToolTabStrip"!!! Please correct me if I'm wrong

Anyway, there's a 3-pixel GAP between the Panel and the ToolWindow (1st image "TW_BAD") I've painted the area I'm talking about in RED so you can see exactly what I'm referring to.

This has got to be either a Padding or a Border but regardless, how do I turn that off?  Hide it?  Make it Visible = Collapsed?

If anyone has this figured out, I can sure use a hand right now.

 

Kindest regards,

Curtis.

 

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 23 May 2025, 11:51 AM

Hi Curtis,

Thank you for the provided images and additional information.

To test your scenario, I have followed the steps and set some color to the ToolWindow and DocumentWindow:

Then I have added a button in both windows and set their Dock property to Fill:

In the above image, we can see that the red color is not visible anymore. I may have missed some settings or misunderstood you. May I ask you to modify my test project and share what I am missing to mimic your settings?

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 23 May 2025, 06:20 PM

Dinko, thanks for the reply.  You've missed my point entirely. 

Even in your screenshots, there's an ugly, white "space" outside of your radButtons 

Again, using Photoshop to fill in the space I'm talking about.  Not the space inside or outside of it - but the exact space represented by the red color.

How do we get rid of that space?  It's like there's an internal container control that has it's padding set = 3,3,3,3

 

Thanks again for your time.

Dinko | Tech Support Engineer
Telerik team
commented on 27 May 2025, 12:13 PM

I want to thank you for the additional details. I see what you mean here. I have checked your requirement, and this space comes from the default margin settings applied to the content area. To remove them, you will need to go through each DockTabStrip and ToolTabStrip and targets their content area padding property. 

void ResetMargins()
{
    foreach (DockTabStrip element in this.documentContainer1.Controls)
    {
        if (element != null)
        {
            element.TabStripElement.ContentArea.Padding = new Padding(0, 0, 0, 0);
            element.TabStripElement.ContentArea.BorderBottomWidth = 0;
            element.TabStripElement.ContentArea.BorderRightWidth = 0;
        }
    }
    foreach (var element in this.radDock1.Controls)
    {
        if (element is ToolTabStrip toolTabStrip)
        {
            toolTabStrip.TabStripElement.ContentArea.Padding = new Padding(0, 0, 0, 0);
        }
    }
}
void ResetMargins()
{
    foreach (DockTabStrip element in this.documentContainer1.Controls)
    {
        if (element != null)
        {
            element.TabStripElement.ContentArea.Padding = new Padding(0, 0, 0, 0);
            element.TabStripElement.ContentArea.BorderBottomWidth = 0;
            element.TabStripElement.ContentArea.BorderRightWidth = 0;
        }
    }
    foreach (var element in this.radDock1.Controls)
    {
        if (element is ToolTabStrip toolTabStrip)
        {
            toolTabStrip.TabStripElement.ContentArea.Padding = new Padding(0, 0, 0, 0);
        }
    }
}

In the above code snippet, you can observe how we also target the Border width. 

Now we have removed the space when the application starts. But if we undock and dock a window, these settings will be reset to their default values. When a window is undocked, it is removed from the main Form and it is added to a newly created Form. To catch this, we can subscribe to the FloatingWindowCreated event. In this event, we can get the newly created Form and iterate its controls.

private void RadDock1_FloatingWindowCreated(object sender, FloatingWindowEventArgs e)
{
    e.Window.Shown -= Window_Shown;
    e.Window.Shown += Window_Shown;
}
private void Window_Shown(object sender, EventArgs e)
{
    RadForm f = sender as RadForm;
    f.FormElement.ImageBorder.Visibility = ElementVisibility.Collapsed;
    f.FormElement.BorderThickness = new Padding(2);
    f.FormElement.Border.ForeColor = Color.Red;

    foreach (Control c in f.Controls)
    {
        RadSplitContainer splitContainer = c as RadSplitContainer;
        if (splitContainer != null)
        {
            foreach (SplitPanel sp in splitContainer.SplitPanels)
            {
                RadPageViewTabStripElement container = sp.SplitPanelElement.FindDescendant<RadPageViewTabStripElement>();
                container.ContentArea.Padding = new Padding(1);
                container.ContentArea.Padding = new Padding(0, 0, 0, 0);
                container.ContentArea.BorderBottomWidth = 0;
                container.ContentArea.BorderRightWidth = 0;
            }

        }
    }
}

Here is the result:

I have worked on my test project and attached it here so that you can further test this solution on your side. 

Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 27 May 2025, 09:05 PM

You nailed it!  Wonderful!

Thank you so much for finding this :)

Cheers!

Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 27 May 2025, 10:30 PM

I made a slight modification to your terrific code to help anyone else looking for this solution:

Private Sub radDock_FormEditor_DockStateChanging(sender As Object, e As DockStateChangingEventArgs) Handles radDock_FormEditor.DockStateChanging
RecurseWindow_Padding(radDock_FormEditor)
End Sub

Private Sub radDock_FormEditor_DockStateChanged(sender As Object, e As DockWindowEventArgs) Handles radDock_FormEditor.DockStateChanged
RecurseWindow_Padding(radDock_FormEditor)
End Sub

Private Sub RecurseWindow_Padding(ByVal p_Parent As Control)
For Each element As Control In p_Parent.Controls
If TypeOf element Is ToolTabStrip Then
Dim toolTabStrip As ToolTabStrip = CType(element, ToolTabStrip)
toolTabStrip.TabStripElement.ContentArea.Padding = New Padding(0, 0, 0, 0)

ElseIf TypeOf element Is RadSplitContainer Then
RecurseWindow_Padding(element)
End If
Next
End Sub

I made the method that adjusts the Padding for tool windows to be recursive in case one of the controls found is a RadSplitContainer - so it'll dig down as deep as needed.

I also included a hook into both DockStateChanging to handle floating windows as well as DockStateChanged to reset after a floating window has been re-docked.

 

Thank you again, I've been trying to do this for a few years now!  You just made my week :)

-C

Dinko | Tech Support Engineer
Telerik team
commented on 28 May 2025, 10:19 AM

I am happy to hear that the suggested approach worked for you. Feel free to contact us again if further assistance is required.
Tags
Dock
Asked by
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or