Hi

I have two windows (Window1 and Window2) and want to set Window1 as the owner of Window2. Furthermore I want the controls on Window1 to be inherited by Window2. For instance I have a listbox list1 on Window1 and I want list1 to be in context even in Window2. Any ideas?

Thanks

Thanks for the prompt response, however this has to do with two windows and not forms. From the link you provided, I have tried some variations to the code but both windows share the same namespace "WpfApplication2" and thus I get errors. What I have as the first window is

public partial class Window1 : Window
{
public Window1()
        {
            InitializeComponent();
        }
}

and for the second window,

public partial class Window2 : Window
{
public Window2()
        {
            InitializeComponent();
        }
}

Most controls are declared in Window1, how can I reference the controls of Window1 in Window2 or apply binding to that of Window2?

Thanks

Edited 5 Years Ago by ibdatx: n/a

To be concise, by adopting the suggestion from the provided link as such

public partial class Window2 : NameSpaceRecipeApp.Window1
    {
        public Window2()
        {
            InitializeComponent();
        }
    }

or even as

public partial class Window2 : NameSpace RecipeApp.Window1
    {
        public Window2()
        {
            InitializeComponent();
        }
    }

errors suffice. With the base class as

public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
    }

the error message is "The type or namespace name 'NameSpaceRecipeApp' could not be found (are you missing a using directive or an assembly reference?)".

I also recieve the error concerning partial classes stating "Partial declarations of 'Classname' must not specify different base classes".

Any idea would be great.

Thanks

This article has been dead for over six months. Start a new discussion instead.