Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm not sure why I get this error and I have been trying a bunch of stuff.

I have this WPF UserControl that I am building:

XML
<UserControl x:Class="OrderPlugin.Views.OrderListUserControl"
 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:wpf="clr-namespace:Material.Icons.WPF;assembly=Material.Icons.WPF"
 xmlns:OrderPlugin="clr-namespace:OrderPlugin"
 xmlns:converters="clr-namespace:Core.UI.Converters;assembly=Core.UI"
 mc:Ignorable="d"
 d:DesignHeight="300" d:DesignWidth="250" MinWidth="250" >
<!-- body omitted -->
</UserControl>


This builds fine. I can start my application, see the controls. I can interact with this and any bindings to viewmodel is working without issue. Then I subscribe to an event:

XML
<UserControl x:Class="OrderPlugin.Views.OrderListUserControl"
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:wpf="clr-namespace:Material.Icons.WPF;assembly=Material.Icons.WPF"
xmlns:OrderPlugin="clr-namespace:OrderPlugin"
xmlns:converters="clr-namespace:Core.UI.Converters;assembly=Core.UI"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="250" MinWidth="250" Loaded="OrderListUserControl_OnLoaded" >

<!-- body omitted -->
</UserControl>

And when I Build i get the error:

Error CS0426 : The type name 'Views' does not exist in the type 'OrderPlugin'


Why? I have done this in other plugins project and user controls and it works fine there.

What I have tried:

I have tried cleaning my project. I have made sure the csproj file looks the same as the others that works fine.

I have tried moving the files to the root of the project, but that just moved the problem:

Error CS0426 : The type name 'OrderListUserControl' does not exist in the type 'OrderPlugin'


So it seems if the UserControl is in its own folder/namespace does not really affect it.

So how does the reference get broken because I add an event?
Posted
Comments
Graeme_Grant 23-Nov-23 10:42am    
There is a lot of information missing in the above question.
* .Net (core) or .Net Framework? What version?
* Are you using a IOC container ? What IOC container library are you using?
* How are you binding the views to the ViewModels? Is there a specific 3rd party library being used?

Also, what line in your code is throwing the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900