
I have some problems with detecting the MdiChild after converting from DockingManager to RadDock.
DockingManager1.ActiveMdiChild returned a form.
In RadDock there is no ActiveMdiChild property, and RadDock1.ActiveWindow returns a DockWindow, which cannot be casted to a form, and my program crashes.
I've tried bool exists = (Array.IndexOf(RadDock1.MdiChildren, RadDock1.ActiveWindow), but it returns false.
My entire code is built on ActiveMdiChild being a form, and it would be a lot of work converting it to DockWindow.
How can I get the currently active MdiChild from the RadDock?
Regards, Jill-Connie Lorentsen
16 Answers, 1 is accepted
Thank you for the question.
Indeed, RadDock does not expose the ActiveMdiChild property. The DockWindows that holds the child forms are actually HostWindows, so you can get a child form as shown below:
Dim
hostWin
As
HostWindow = TryCast(
Me
.radDock1.ActiveWindow, HostWindow)
If
hostWin IsNot
Nothing
Then
Dim
mdiChild
As
Form =
CType
(hostWin.Content, Form)
' or if you want to get the index
Dim
indexInChildren
As
Integer
= Array.IndexOf(radDock1.MdiChildren, mdiChild)
End
If
If you have to put this code snippet in many places, it would be better if you extend RadDock exposing a property called ActiveMdiChild. In the getting of this property you can place the suggested implementation. Finally, you should replace the RadDock type with your custom type.
Best wishes,
Nikolay
the Telerik team

Thank you for writing.
If I understand correctly you want to add an MDI child by pressing a button in other MDI child. In this case you need to retrieve the main form and set it as MdiParent of the new form:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
Form1 mainForm =
this
.Parent.Parent.Parent.Parent.Parent
as
Form1;
if
(mainForm !=
null
)
{
Form2 childForm =
new
Form2();
childForm.Text =
"MDI Child "
+ DateTime.Now.ToShortTimeString();
childForm.MdiParent = mainForm;
childForm.Show();
}
}
Please let me know if there is something else I can help you with.
Dimitar
Telerik
See What's Next in App Development. Register for TelerikNEXT.

Thank you for writing back.
I have attached a small sample that shows how this can be achieved. Could you please check it and let me know how it fits in your case?
I am looking forward to your reply.
Dimitar
Telerik
See What's Next in App Development. Register for TelerikNEXT.


Hi,
I am unable to install all Telerik data access files in my new system. Some files are not installed in my new system e.g:bin, dsl2013 etc files are missing can you please help me.I am also unable to find "Telerik.open access.dll" in bin folder
Thank you for contacting us.
The outcome you experience is expected with Data Access Q3 2015 as the Visual Studio integration (the support for .rlinq files) was deprecated with Data Access Q2 2015. The last version of Data Access that distributes the assemblies and supports .rlinq files is Q1 2015. Currently, the Data Access runtime assemblies are available only through five NuGet packages. More details on the deprecation are available in this blog post.
In order to maintain and upgrade further your existing projects that consume Data Access (especially such with .rlinq files), you can apply any of the following suggestions:
Option 1*: Migrate the .rlinq file to a fluent model and integrate the latest NuGet packages. The details and the workflow about the migration process are available here. With this option you will be able to work with Visual Studio 2012, Visual Studio 2013, and Visual Studio 2015, but all the changes in the database will have to be applied in the model manually.
Option 2*: Freeze the version of Data Access on Q1 2015. Since Data Access Q1 2015 is the last version that distributes the Visual Studio integration, with this option you won't need to migrate the model. With this option you will have the integration in Visual Studio 2012 and Visual Studio 2013 (meaning that you will be able to work as you used to with your .rlinq file), but you will not be able to upgrade the solution to Visual Studio 2015.
*You will need to obtain Data Access Q1 2015 (you can download it from your Telerik account, here).
I hope this helps.
Regards,
Doroteya
Telerik


How to get the form in raddock on click of a button or tab in ribbon bar which is present in the mdiparent form.Could anyone solve this issue?
The following snippet shows how you can get the current MDI form:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
var wnd = radDock1.ActiveWindow
as
HostWindow;
var mdiForm = wnd.Content
as
Form;
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik

What is the cause of this error?
Which does not open by clicking the corresponding form button
Form1 mainForm = this.Parent.Parent.Parent.Parent.Parent as Form1;
if (mainForm != null)
{
Form2 childForm = new Form2();
childForm.Text = "MDI Child " + DateTime.Now.ToShortTimeString();
childForm.MdiParent = mainForm;
childForm.Show();
}

This code is used when you are creating a child form from another child form. When creating child form from the main form it is not needed:
private
void
radButtonElement1_Click(
object
sender, EventArgs e)
{
Form2 childForm =
new
Form2();
childForm.Text =
"MDI Child "
+ DateTime.Now.ToShortTimeString();
childForm.MdiParent =
this
;
childForm.Show();
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik

I want to open the forms as an attached image
I have attached a small example that shows this.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik