Project Can't Find Its Converters

RogerSchlueter-7899 1,236 Reputation points
2022-07-31T00:31:37.25+00:00

My current project uses a number of converters for XAML binding. These converters live in a project directory called "Converters". At compile-time I get error messages for all the converters such as this one:

The name "DateToNull" does not exist in the namespace "clr-namespace:PIM"

PIM is the name of the project.

I figured that this was due to putting them in the project directory however, when I move them to the project itself, I still get the same error message. Here is a snippet of the relevant XAML:

Window  
	x:Class="People"  
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
	....  
	xmlns:self="clr-namespace:PIM">  
	<Window.Resources>  
		<self:DateToNull x:Key="conDate" />   '***** Error *****  
		....  
	</Window.Resources>  
	....  
/Window>  

I have tried deleting the converters and re-entering them directly in the project, to no avail. My questions are:

  1. How can I fix this problem?
  2. If I put the oonverters back into the directory do I have to modify the XAML to tell VS where to find them?
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
769 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hui Liu-MSFT 41,146 Reputation points Microsoft Vendor
    2022-08-01T01:49:31.793+00:00

    Hi,@RogerSchlueter-7899 . Welcome Microsoft Q&A. I'm not sure about your specific code and project structure. I tried to make an example based on your scenario, you could try to refer to it.

    Project structure:
    226478-image.png
    Xaml:

    <Window x:Class="PIM.MainWindow"  
       ...  
            xmlns:local="clr-namespace:PIM"  
            xmlns:con="clr-namespace:PIM.Converters"  
            mc:Ignorable="d"  
            Title="MainWindow" Height="450" Width="800">  
        <Window.Resources>  
            <con:DataToNull x:Key="conDate"/>  
            <local:Converter1 x:Key="converter1"/>  
        </Window.Resources>  
        <Grid>  
    
        </Grid>  
    </Window>  
    

    VS will tell "name A does not exist in namespace clr-namespace:B" when you are writing wpf code. But you could build your project completely successfully with only a little inconvenience because you can't see the UI design (or just want to clean up the code).

    Try to do these:

    • right click on your Solution in VisualStudio -> Properties -> Configuration Properties
    • A new dialog is opened, try to change the project configurations from Debug to Release or vice versa.

    After that, rebuild your solution. It can solve your problem.

    If you still have questions, please feel free to let me know.


    If the response is helpful, please click "Accept Answer" and upvote it.
     Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread. 

    [5]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html


1 additional answer

Sort by: Most helpful
  1. robertrocks2342 1 Reputation point
    2022-08-18T11:56:53.827+00:00

    The power choices that work all sidestep the Uno's 5V controller. The one choice that doesn't work goes through the controller. The most probable clarification is that the lot of intensity dispersed by the drop from 12V to 5V, at high current, is making the controller overheat, and it presumably has a warm closure capability that diminishes yield current when it gets hot. On the off chance that that is the issue, you would have to utilize a much lower voltage block, for example, 7V, or utilize a 5V block which would interface straightforwardly to the 5V pin of the Uno. I don't think a fan will be useful.