How to have two XAML files with one code per file in WPF

I want to have two XAML (Window) files, having one code per file (filename.xaml.cs) in my WPF application.


source to share

1 answer

Code per file corresponds to one root element in XAML, so it is not possible for 2 files to share code per file.

Thus, you can often accomplish basic goals with other methods, including:

  • Use UserControl

    for "child" content and include the control directly in the main XAML file.
  • Use pooled resource dictionaries for resource / style allocation


All Articles