Search code examples
c#wpfmdichild

Bring MdiChild To Front (Using WPF.MDI)


I'm trying to make MdiForm on WPF application. But I'm getting stuck on how to bring to front selected form. In VB6 I usually used

FrmName.ZOrder

Is there any similarity I can use on WPF?

Anyway this is my code:

using WPF.MDI;
foreach (MdiChild c in mdiMain.Children)
{
    if (c.Title == "Setup Customer")
    {
        c.BringToFront();    //I'm having trouble here
        return;
    }
}

Solution

  • try this:

    foreach (MdiChild c in mdiMain.Children)
    {
        if (c.Title == "Setup Customer")
        {
            c.Focus();    //TRY THIS
            return;
        }
    }
    

    Don't forget to mark this as answer too if it fits your needs