This happened to me because Visual Studio sets the "Build action" to some random action when you copy/paste or move an XAML file from one project to another within a solution.
Solution: Make sure your "Build action" is set to page for you XAML.
I hope this helps if it's the same case for you.