From your code, you need to do three things to read the XamlWithControls.xaml.
- Add the subfolder before XamlWithCotrols.xaml. get => (ContentControl)XamlReader.Load(new FileStream("pages/XamlWithControls.xaml", FileMode.Open));
2.Make the XamlWithControls.xaml as Content for the Build Action
3.[You missed this step]Choose Copy if newer/Copy always for Copy to Output Directiory.Reason: FileStream reads files in the bin\Debug folder under the current project when it using the relative path.