Joseph Izang
Joseph Izang

Reputation: 755

WPF UserControl Direct Content

Got this problem that seems to be a popular one but not sure what is going on here. I have a solution in Visual studio 2015 community that has an asp.net webapi project, a WPF project that has the prism library added using nuget. I am using Prism 6 and want to create a solution with modules. Everything is ok until I add a usercontrol to my module and then I get the error "the type 'UserControl' does not support direct content" and I see errors under the grid tag and anything I put under it. All I added to my xaml file is the new prism namespace and the viewmodellocator line of code. Can someone point me in the right direction.

Below is the Usercontrol that I created and the error is at the line with the grid tag

<UserControl x:Class="LoginModule.Views.LoginForm"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:LoginModule.Views"
         xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>

</Grid>

Upvotes: 0

Views: 917

Answers (1)

Joseph Izang
Joseph Izang

Reputation: 755

Thanks for all your help. I finally figured the thing out. I added the reference System.Xaml and it went away. Apparently, IComponentConnector was moved from System.Windows.Markup to System.Xaml. Adding the reference resolved the issue and everything builds at least with no errors. This is not strange considering that the modules I am developing start out as class libraries so System.Xaml isn't added when the project is created unlike when you create a wpf project. Hope this saves someone the confusion I have had for the last day or so.

Upvotes: 2

Related Questions