XAML View Designer is missing for single file

190 Views Asked by At

I have two, in my opinion, identical files:
enter image description here

They both have the following properties:
enter image description here

Now upon opening the second, I get a splitview with XAML Designer and XAML Code. Upon opening the first, I only get a window with XAML Code.

When I right-click the file where the XAML Designer is not opening, both options "View Code" and "View Designer" are missing:

enter image description here

The WPF app compiles and runs as expected. The page, where the designer works, is my entry page (if this matters). The other page is a "popup" page when a specific button is pressed.

I am using the latest version of MS VS 2022 Preview.

Has anyone a fix for this?

EIDT:

Window properties of first file:

<Window x:Class="RotaxTools.Integrity.ResolveMergeConflicts.Views.AcceptMergeErrorView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:viewModels="clr-namespace:RotaxTools.Integrity.ResolveMergeConflicts.ViewModels"
        xmlns:converter="clr-namespace:RotaxTools.Integrity.ResolveMergeConflicts.Converter"
        d:DataContext="{d:DesignInstance Type=viewModels:AcceptMergeErrorsViewModel}"
        TextElement.Foreground="{DynamicResource MaterialDesignBody}"
        TextElement.FontWeight="Regular"
        TextElement.FontSize="12"
        TextOptions.TextFormattingMode="Ideal"
        TextOptions.TextRenderingMode="Auto"
        FontFamily="{DynamicResource MaterialDesignFont}"
        Background="{DynamicResource MaterialDesignPaper}"
        mc:Ignorable="d"
        Title="Resolve Merge Conflicts"
        Height="480"
        Width="640"
        WindowStartupLocation="CenterOwner">

Window properties of second file:

<Window x:Class="RotaxTools.Integrity.ResolveMergeConflicts.Views.SandboxView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:viewModels="clr-namespace:RotaxTools.Integrity.ResolveMergeConflicts.ViewModels"
        xmlns:converter="clr-namespace:RotaxTools.Integrity.ResolveMergeConflicts.Converter"
        d:DataContext="{d:DesignInstance Type=viewModels:SandBoxViewModel}"
        TextElement.Foreground="{DynamicResource MaterialDesignBody}"
        TextElement.FontWeight="Regular"
        TextElement.FontSize="13"
        TextOptions.TextFormattingMode="Ideal"
        TextOptions.TextRenderingMode="Auto"
        FontFamily="{DynamicResource MaterialDesignFont}"
        Background="{DynamicResource MaterialDesignPaper}"
        mc:Ignorable="d"
        Title="Resolve Merge Conflicts"
        MinHeight="800"
        MinWidth="1440"
        Height="800"
        Width="1440">

EDIT2: I've added the tag <SubType>Designer</SubType> to the corresponding .xaml file within the .csproj file. Now Show Designer shows up in the right-click menu but upon clicking nothing happens. The window looks like this:

enter image description here

.csproj-File:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{5C1E038E-B3BA-43FA-A59C-E2DB76FD30D5}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>RotaxTools.Integrity.ResolveMergeConflicts</RootNamespace>
    <AssemblyName>ResolveMergeConflicts</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <PublishUrl>publish\</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Disk</InstallFrom>
    <UpdateEnabled>false</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <UseApplicationTrust>false</UseApplicationTrust>
    <BootstrapperEnabled>true</BootstrapperEnabled>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Resources\merge.ico</ApplicationIcon>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    <PlatformTarget>x86</PlatformTarget>
    <OutputPath>bin\x86\Debug\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <PlatformTarget>x86</PlatformTarget>
    <OutputPath>bin\x86\Release\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
    <PlatformTarget>x64</PlatformTarget>
    <OutputPath>bin\x64\Debug\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
    <PlatformTarget>x64</PlatformTarget>
    <OutputPath>bin\x64\Release\</OutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="JetBrains.Annotations, Version=2021.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
      <HintPath>..\packages\JetBrains.Annotations.2021.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
    </Reference>
    <Reference Include="MaterialDesignColors, Version=1.2.0.325, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\MaterialDesignColors.1.2.0\lib\net45\MaterialDesignColors.dll</HintPath>
    </Reference>
    <Reference Include="MaterialDesignThemes.Wpf, Version=2.6.0.325, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Security" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Compile Include="Commands\RelayCommand.cs" />
    <Compile Include="Common\Common.cs" />
    <Compile Include="Converter\CountToVisibilityConverter.cs" />
    <Compile Include="Models\MergeErrors\MergeErrorActionAdd.cs" />
    <Compile Include="Models\MergeErrors\MergeErrorActionDrop.cs" />
    <Compile Include="Models\MergeErrors\MergeErrorActionForceConflict.cs" />
    <Compile Include="Models\MergeErrors\MergeErrorAnalyzer.cs" />
    <Compile Include="Models\MergeErrors\MergeErrorAction.cs" />
    <Compile Include="Models\MergeFile.cs" />
    <Compile Include="Models\MergeErrors\UnresolvableMergeError.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="ViewModels\BaseViewModel.cs" />
    <Compile Include="ViewModels\AcceptMergeErrorsViewModel.cs" />
    <Compile Include="ViewModels\MergeFileViewModel.cs" />
    <Compile Include="ViewModels\SandBoxViewModel.cs" />
    <Page Include="Themes\Generic.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Views\SandboxView.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="Views\SandboxView.xaml.cs">
      <DependentUpon>SandboxView.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Page Include="Views\AcceptMergeErrorActions.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="Views\AcceptMergeErrorActions.xaml.cs">
      <DependentUpon>AcceptMergeErrorActions.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <SubType>Designer</SubType>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <Resource Include="Resources\merge.ico" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Common\Common.csproj">
      <Project>{CBD8F622-2BF9-4424-80E3-799336911852}</Project>
      <Name>Common</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="Properties\AssemblyInfo.tt">
      <LastGenOutput>AssemblyInfo1.cs</LastGenOutput>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
      <Visible>False</Visible>
      <ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <ItemGroup>
    <Resource Include="Resources\cross.png" />
  </ItemGroup>
  <ItemGroup>
    <Resource Include="Resources\check.png" />
  </ItemGroup>
  <ItemGroup>
    <WCFMetadata Include="Connected Services\" />
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="PostBuildMacros">
    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
      <Output TaskParameter="Assemblies" ItemName="Targets" />
    </GetAssemblyIdentity>
  </Target>
  <PropertyGroup>
    <PreBuildEvent>"%25VSAPPIDDIR%25TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt"</PreBuildEvent>
  </PropertyGroup>
  <Target Name="PostBuildMacros">
    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
      <Output TaskParameter="Assemblies" ItemName="Targets" />
    </GetAssemblyIdentity>
    <ItemGroup>
      <VersionNumber Include="@(Targets->'%(Version)')" />
    </ItemGroup>
  </Target>
  <PropertyGroup>
    <PostBuildEventDependsOn>
            $(PostBuildEventDependsOn);
            PostBuildMacros;
        </PostBuildEventDependsOn>
    <PostBuildEvent>
            echo --- Calling Integrity Checkin tool ---
            cmd.exe /c start $(SolutionDir)SolutionTools\IntegrityCheckin\CSharpProjectIntegrityCheckin.exe --solutionName=$(SolutionName) --solutionPath=$(SolutionDir) --projectName=$(ProjectName) --projectPath=$(ProjectDir) --buildPath=$(TargetDir) --buildConfig=$(ConfigurationName) --assemblyVersion=@(VersionNumber) --integrityBuildProject=/SWClassBRP/ToolsSource/Builds/IntegrityToolChain/$(ProjectName)
        </PostBuildEvent>
  </PropertyGroup>
</Project>
1

There are 1 best solutions below

0
MichaelS On

The fix was to add a WPF Window to the project and copy all source code (XAML + Code Behind) over. I think I created a Content Page before, but I did not find where any settings would differ.