Merge XAML and code-behind file in Visual Studio

When you’re importing Windows Phone view file (XAML + its class file) into a project, it’s shown in Visual Studio as separate files. Compared to when you’re creating a new view file, its class file (code-behind) is grouped behind the XAML file.

To ‘merge’ these two files, you need to edit the project settings file (*.csproj file)

<Compile Include="MainPage.xaml.cs"/>


<Compile Include="MainPage.xaml.cs">


DataContractJsonSerializer missing assembly reference

DataContractJsonSerializer class is declared under System.Runtime.Serialization assembly. Even when the assembly is already added to project reference, it’s still complaining about missing assembly.

It’s actually included in System.Servicemodel.Web assembly. Include it to your Windows Phone project reference will solve the error.