Getting the active MdiChild from RadDock?

10 posts, 0 answers
  1. Jill-Connie Lorentsen
    Jill-Connie Lorentsen avatar
    118 posts
    Member since:
    Nov 2008

    Posted 14 Apr 2011 Link to this post

    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

  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 19 Apr 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. PEDDI
    PEDDI avatar
    5 posts
    Member since:
    Apr 2015

    Posted 27 Apr 2015 Link to this post

    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 ? 
  5. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 29 Apr 2015 Link to this post

    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.

     
  6. PEDDI
    PEDDI avatar
    5 posts
    Member since:
    Apr 2015

    Posted 30 Apr 2015 Link to this post

    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  
  7. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 04 May 2015 Link to this post

    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.

     
  8. PEDDI
    PEDDI avatar
    5 posts
    Member since:
    Apr 2015

    Posted 04 May 2015 in reply to Dimitar Link to this post

    Thank  for  the solution :)
  9. PEDDI
    PEDDI avatar
    5 posts
    Member since:
    Apr 2015

    Posted 10 Mar in reply to PEDDI Link to this post

    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 

  10. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 15 Mar Link to this post

    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.
  11. PEDDI
    PEDDI avatar
    5 posts
    Member since:
    Apr 2015

    Posted 16 Mar in reply to Doroteya Link to this post

    Thanks for the reply 
Back to Top
UI for WinForms is Visual Studio 2017 Ready