In my WPF4 desktop application all windows have the same structure — header & footer with some main menu and copyright marks; left-side navigation menu and body (center of screen) where I show data, main toolbar etc. Body block is the only block that changes in all windows, e.g. in window with students I show DataGrid
with students' data, in window with new course form user can fill in form and submit it to DB. All this stuff is located in Body section of windows.
In order to improve reusability of the code, I use inheritance of C# code, where I store all basic window functions in GeneralWindow
and all other windows extend this class.
My questions:
Can I use the same technique in order to reduce copy of the same code-block in XAML-part of the window? For the moment, each window class has the same blocks of XAML code (e.g. left side menu, header, footer).
How can I reduce code duplication and use the same technique as I used in the case of C#? Is it possible to inheritance XAML-class (.xaml) that I could define all basic stuff in one class and all other will just extend/inherit the design of this class? To increase the code reusability.
You should create one window and put Frame on it. Then dynamically load Pages in Frame.