0

When I link a class that's from reference project, there is a mistake as the picture below. enter image description here

The project "RecipeLib" is added in references, as the picture below. enter image description here

When I shift the class "Station" to "Recipe GUI"(and change namespace as well), the code work properly. I'm wondering if it is legal, and how to correct? Thank you in advance!

Colin
  • 23
  • 4
  • 1
    You already have `xmlns:local="clr-namespace:Recipe_GUI"`, so why do you declare the same again as `src`? You may use `src` for the library: `xmlns:src="clr-namespace:RecipeLib"`. – Clemens Oct 14 '22 at 12:47
  • Sorry because it is a testing project, some codes are not fully reasonable... But even I change the namespace to RecipeLib, there is still a mistake with the same message. Actually there is no class in RecipeLib shown in the options. – Colin Oct 14 '22 at 23:04
  • 1
    You have not told us about the namespace(s) in RecipeLib, but assuming the namespace is also RecipeLib, the XAML namespace declaration should be `xmlns:src="clr-namespace:RecipeLib;assembly=RecipeLib"`. Please read [XAML Namespaces and Namespace Mapping for WPF XAML](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml?view=netframeworkdesktop-4.8). – Clemens Oct 15 '22 at 05:45
  • `assembly=RecipeLib` is the code missing, now the code work as expect. I will learn the document attached carefully. Thank you very much! – Colin Oct 15 '22 at 06:22

0 Answers0