Reputation: 872
I'm pulling my hair out and can't figure out what's the problem.
MyProject
MyProject.GUI
Inside MyProject.GUI
there are three elements: Form
, Keyboard
and SelectWrapper
There we go (no .xaml, just .cs)
namespace MyProject.GUI
{
public class SelectWrapper : Grid
...
and keyboard cs
namespace MyProject.GUI
{
public partial class Keyboard : UserControl
{
...
and keyboard xaml
<UserControl
x:Class="MyProject.GUI.Keyboard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
and form .cs
namespace MyProject.GUI
{
public partial class Form : Window
...
and form XAML
<Window
x:Class="MyProject.GUI.Form"
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:gui="clr-namespace:MyProject.GUI"
...
<gui:Keyboard
<gui:SelectWrapper
And the compiler (as well as the designer) complains:
The type name 'GUI' does not exist in the type 'MyProject'
The type name 'GUI' does not exist in the type 'MyProject'
The name "SelectWrapper" does not exist in the namespace "clr-namespace:MyProject.GUI".
It doesn't complain about the keyboard tho (only the Form). Please assist.
Upvotes: 0
Views: 559
Reputation: 37060
If the compiler says MyProject
is a type, I would start with the assumption that there's a type somewhere by that name. I was able to reproduce this by defining a class named MyProject
in the MyProject.GUI
namespace:
namespace MyProject.GUI
{
public partial class Form : Window
{
public Form()
{ ... }
}
public class MyProject
{
}
public class SelectWrapper
{
}
}
XAML
<Window
x:Class="MyProject.GUI.Form"
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:gui="clr-namespace:MyProject.GUI"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<gui:SelectWrapper
x:Key="test"
/>
</Window.Resources>
Error CS0426 The type name 'GUI' does not exist in the type 'MyProject'
Error CS0426 The type name 'GUI' does not exist in the type 'MyProject'
Error The name "SelectWrapper" does not exist in the namespace "clr-namespace:MyProject.GUI".
So I would look for a class by that name in the project, or elsewhere in the solution.
Upvotes: 1
Reputation: 169150
The Keyboard
class resides in another namespace, namely InvoiceFlow.GUI
, doesn't it?
<Window
x:Class="MyProject.GUI.Form"
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:gui="clr-namespace:MyProject.GUI"
xmlns:kbd="clr-namespace:InvoiceFlow.GUI"
...
<kbd:Keyboard
<gui:SelectWrapper
You need to make sure that there are no other compile errors as well for you to be able to build.
Upvotes: 1