11 Answers, 1 is accepted
Thank you for the question.
A DockWindow does not have a DockPosition property, because DockWindows may be arranged in a docking hierarchy (you can dock a DockWindow to a position, passing another DockWindow as a base anchor) and such property value would be inaccurate without knowing the value of the base anchor as well.
Could you please share with me the scenario where you need to take the DockPosition value? This will allow us to think of an implementation that will best suit your needs.
I am looking forward to your response.
Greetings,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Judging by your description, I think that you need the GetAutoHidePosition method which returns the position of a DockWindow relative to the RadDock control (the main container):
Type type =
typeof
(RadDock);
MethodInfo method = type.GetMethod(
"GetAutoHidePosition"
, BindingFlags.Instance | BindingFlags.NonPublic);
object
o = method.Invoke(
this
.radDock1,
new
object
[] { (ToolTabStrip)
this
.radDock1[
"MHM"
].TabStrip });
AutoHidePosition position = (AutoHidePosition)o;
this
.Text = position.ToString();
However, if you want to get the position of a DockWindow relative to its base anchor, you can do it as it is demonstrated below. Please note that in this case you should pass not only the ToolTabStrip of the ToolWindow of interest, but the anchor ToolTabStrip as well:
public
DockPosition GetDockPositionFromAnchor(ToolTabStrip tabStrip, ToolTabStrip anchorStrip)
{
RadSplitContainer container = tabStrip.SplitContainer;
int
tabStripPanelIndex = container.SplitPanels.IndexOf(tabStrip);
int
anchorStripPanelIndex = container.SplitPanels.IndexOf(anchorStrip);
if
(tabStrip.SplitContainer.Orientation == Orientation.Vertical)
{
if
(tabStripPanelIndex > anchorStripPanelIndex)
{
return
DockPosition.Right;
}
else
{
return
DockPosition.Left;
}
}
else
{
if
(tabStripPanelIndex < anchorStripPanelIndex)
{
return
DockPosition.Top;
}
else
{
return
DockPosition.Bottom;
}
}
}
You can call the method like this:
GetDockPositionFromAnchor((ToolTabStrip)toolWindow5.TabStrip, (ToolTabStrip)toolWindow4.TabStrip)
I hope this helps. If you have additional questions, feel free to contact me.
Kind regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Thank you for getting back to me.
This is the reason I mentioned that a DockPosition value will be irrelevant without knowing the anchor TabStrip value. When you dock a window setting another window as a base anchor, all RadDock does is place the window in the appropriate TabStrip. However, no further information is kept for the base anchor of this window and its tabstrip.
Could you please share with us what will be determined by the DockPosition value that you want to query? How will this affect your application? This information will help us to think of a more suitable approach if such can be implemented. Generally, if you only dock windows programmatically, you can save the DockPosition in the Tag property of the HostWindow.
Best wishes,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

I used your example code to get the position of a tool window that the user has docked and autohidden to the bottom of the RadDock. Unfortunately this method always returns "Left". Can you tell me if I have the parameters wrong or something?
Type type = typeof(RadDock);
MethodInfo method = type.GetMethod("GetAutoHidePosition", BindingFlags.Instance | BindingFlags.NonPublic);
object o = method.Invoke(toolWindow.DockManager, new object[] { (ToolTabStrip)toolWindow.TabStrip });
AutoHidePosition position = (AutoHidePosition)o;
side = position.ToString();
Thank you for the question.
This code snippet concerns the TabStrip of a ToolWindow when this ToolWindow is in Docked state. However, the TabStrip property of the ToolWindow is only valid when the window is in Docked state and you should not try to work with it when it is in AutoHide mode. I am attaching a sample project which demonstrates how you can get the correct position although the window is AutoHide. Basically, you should keep the AutoHidePosition while the window is Docked and save this position in the Tag of the ToolWindow when it becomes AutoHide.
I hope this helps.
Sincerely yours,
Nikolay
the Telerik team

Nikolay,
I'm in need of a solution for this in the current version of Telerik UI for WinForms for autohidden windows. I downloaded your sample project but it doesn't seem to be working correctly anymore (it always returns left when the window is autohidden). Could you offer a different solution? I'm attempting to work around this bug.
Thanks!
Thank you for writing.
I am sending you attached a project implementing the suggested by my colleague approach. It is working correctly with the latest version of the suite.
In case you are having issues with the reported issue and the suggested workaround please open up a support ticket and send us your project.
I am sending you attached my project as well as a short animation.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik

Hristo,
Thanks for sending me that project. I wasn't thinking clearly before - I understood that it wasn't possible to obtain the DockPosition while a DockWindow was in autohide mode, but I also didn't realize that whenever a user docked a floating window, its DockState would default to 'Docked' rather than 'AutoHide', so I could just grab the DockPosition while the DockWindow was 'Docked'.
I actually submitted the suggested workaround but found that it wouldn't work if a user decided to change the DockPosition of any of the windows :)
Here's the code that I used:
Private
Sub
RadForm1_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
RadDock1.DockWindow(ToolWindow2, DockPosition.Right)
RadDock1.AutoHideWindows(
New
DockWindow() {ToolWindow2}, AutoHidePosition.Right)
ToolWindow2.Tag = DockPosition.Right
RadDock1.AutoHideWindow(ToolWindow1)
ToolWindow1.Tag = DockPosition.Left
End
Sub
Private
Sub
RadDock1_FloatingWindowCreated(sender
As
Object
, e
As
FloatingWindowEventArgs)
Handles
RadDock1.FloatingWindowCreated
For
Each
dw
As
DockWindow
In
CType
(sender, RadDock).DockWindows
If
dw.Handle <>
CType
(sender, RadDock).ActiveWindow.Handle
AndAlso
dw.DockState = DockState.AutoHide
Then
dw.DockState = dw.PreviousDockState
RadDock1.AutoHideWindows(
New
DockWindow() {dw}, dw.Tag)
End
If
Next
End
Sub
Private
Sub
RadDock1_DockStateChanged(sender
As
Object
, e
As
DockWindowEventArgs)
Handles
RadDock1.DockStateChanged
If
e.DockWindow.DockState = DockState.Docked
Then
e.DockWindow.Tag = GetDockPostition(e.DockWindow)
End
If
End
Sub
Public
Function
GetDockPostition(window
As
DockWindow)
As
AutoHidePosition
Dim
type
As
Type =
GetType
(RadDock)
Dim
mi
As
Reflection.MethodInfo =
Me
.RadDock1.[
GetType
]().GetMethod(
"GetAutoHidePosition"
, Reflection.BindingFlags.Instance
Or
Reflection.BindingFlags.NonPublic)
Dim
res
As
Object
= mi.Invoke(
Me
.RadDock1,
New
Object
() {
DirectCast
(
Me
.RadDock1(window.Name).TabStrip, ToolTabStrip)})
Dim
aHPposition
As
AutoHidePosition =
DirectCast
(res, AutoHidePosition)
Return
aHPposition
End
Function
I am glad that you have resolved the issue. Thank you also for commenting on the feedback item and referring this thread.
Please let me know if you need additional assistance.
Regards,
Hristo Merdjanov
Telerik