This is a migrated thread and some comments may be shown as answers.

Getting the active MdiChild from RadDock?

16 Answers 300 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Jill-Connie Lorentsen
Top achievements
Rank 1
Jill-Connie Lorentsen asked on 14 Apr 2011, 12:01 PM

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

Sort by
0
Nikolay
Telerik team
answered on 19 Apr 2011, 04:48 PM
Hello Jill-Connie Lorentsen,

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
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
0
PEDDI
Top achievements
Rank 1
answered on 27 Apr 2015, 07:52 AM
i have a radgroupbox in child form . In the radgroup box there is a button  and when i click that button i want the form to be opened in the raddock document window how can i achieve this ? 
0
Dimitar
Telerik team
answered on 29 Apr 2015, 12:46 PM
Hello Peddi,

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. 
 
Regards,
Dimitar
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
PEDDI
Top achievements
Rank 1
answered on 30 Apr 2015, 07:29 AM
There is a button in raddock child form.When i click that button a form should be opened in raddock only but it is not opening in raddock it is opening out of raddock can anybody solve this issue  
0
Dimitar
Telerik team
answered on 04 May 2015, 12:16 PM
Hi Peddi,

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.
 
Regards,
Dimitar
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
PEDDI
Top achievements
Rank 1
answered on 04 May 2015, 02:22 PM
Thank  for  the solution :)
0
PEDDI
Top achievements
Rank 1
answered on 10 Mar 2016, 03:16 PM

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 

0
Doroteya
Telerik team
answered on 15 Mar 2016, 04:57 PM
Hi PEDDI,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
PEDDI
Top achievements
Rank 1
answered on 16 Mar 2016, 06:05 AM
Thanks for the reply 
0
sabrin
Top achievements
Rank 1
answered on 21 Oct 2017, 09:08 AM

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?

 

0
Dimitar
Telerik team
answered on 23 Oct 2017, 06:48 AM
Hi Sabrin,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
k
Top achievements
Rank 1
answered on 05 Dec 2017, 08:34 AM

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();
            }

0
k
Top achievements
Rank 1
answered on 05 Dec 2017, 08:36 AM
File sa to zip
0
Dimitar
Telerik team
answered on 05 Dec 2017, 01:05 PM
Hello K,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
k
Top achievements
Rank 1
answered on 06 Dec 2017, 07:13 PM
Hello and thanks
I want to open the forms as an attached image
0
Dimitar
Telerik team
answered on 11 Dec 2017, 10:25 AM
Hello K,

I have attached a small example that shows this.

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Dock
Asked by
Jill-Connie Lorentsen
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
PEDDI
Top achievements
Rank 1
Dimitar
Telerik team
Doroteya
Telerik team
sabrin
Top achievements
Rank 1
k
Top achievements
Rank 1
Share this question
or