问题
I have an error that not let me see my designer.. but I have no error on a build and my program runs fine with no problem
I have tried to:
- Clean and Rebuild
- Update Visual Studio
- Repair Visual Studio
- Restart my pc
Nothing helped. I have no idea what more I can to do to solve it.
I have to try to see in here and not worked for me even after restarted visual studio, re-built the solution
the name <...> does not exist in the namespace clr-namespace <...>
this is my Error:
this is Xaml file:
<Window x:Class="PulserTester.windows.ConfigPage"
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:PulserTester.windows"
xmlns:Convertors="clr-namespace:PulserTester.Convertors"
mc:Ignorable="d"
d:DesignHeight="575.068" Width="500">
<Window.Resources>
<Convertors:NumericTextBoxConvertor x:Key="NumericTextBoxConvertor" />
</Window.Resources>
<Grid Background="White">
<StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">שם הפולסר</TextBlock>
<TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding PulserName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">האם להציג הודעה במצב של כישלון</TextBlock>
<CheckBox HorizontalAlignment="Right" IsChecked="{Binding FailQuestion,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">האם לאפשר בדיקת כיול</TextBlock>
<CheckBox HorizontalAlignment="Right" IsChecked="{Binding CalibrationOption,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">סגנון הבדיקה</TextBlock>
<ComboBox HorizontalAlignment="Right" Width="213"
ItemsSource="{Binding CheckStyles.Keys}"
SelectedItem="{Binding CheckStyleSelected,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
></ComboBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">מספר המפעל</TextBlock>
<ComboBox HorizontalAlignment="Right" Width="213"
ItemsSource="{Binding FactoriesNumbers}"
SelectedItem="{Binding FactorySelected,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
></ComboBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">תדירות השמירה בבידקות</TextBlock>
<TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding SaveBatteryFreq,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource NumericTextBoxConvertor}}"></TextBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">לאפשר גבולות סטטסיטיים</TextBlock>
<CheckBox HorizontalAlignment="Right" IsChecked="{Binding AllowUsingStatistic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></CheckBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">מספר התאים לתחילת הסטטסיטיקה</TextBlock>
<TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding NumberOfCellToStartTheStatistics,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={ StaticResource NumericTextBoxConvertor}}"></TextBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock HorizontalAlignment="Right">מספר התאים להתחול הסטטיסטיקה מחדש</TextBlock>
<TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding NumberOfCellToRestartTheStatistics,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={ StaticResource NumericTextBoxConvertor}}"></TextBox>
</StackPanel>
<StackPanel Margin="5">
<Button Command="{Binding Path=SaveCommand}">bb</Button>
</StackPanel>
</StackPanel>
</Grid>
</Window>
this is my convertor:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace PulserTester.Convertors
{
public class NumericTextBoxConvertor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string val = value.ToString();
long ret = long.TryParse(new string(val.Where(char.IsDigit).ToArray()), out long result) ? result : 0;
if (ret > int.MaxValue)
{
ret = int.MaxValue;
}
return ret;
}
}
}
回答1:
I just want to reiterate a solution that Bradley Uffner mentioned buried in the comments above.
Close Visual Studio
Delete the hidden
.vs
folderOpen Visual Studio and rebuild your project
Keep in mind that this is a very generic error that has multiple causes and solutions, so this may not work for you, but it's definitely worth a shot since I know it has worked for me in the past on several occasions.
回答2:
I met the same issue. I tried to build and rebuild my solution, but it didn't work. Finally, I've closed Visual Studio and re-opened it, and it's fixed!
回答3:
You can switch to another framework version then switch back to your version, in my case I'm using VS 16.4. I changed from framework 4.6.2 to 4.7.2 then switch back to 4.6.2.
This simple action solve XDG0008 and XDG0012 in my project.
回答4:
I was able to get rid if this problem in the past by adding the actual assembly name to the namespace reference like this:
xmlns:windowManager="clr-namespace:PulserTester.Convertors;assembly=TheNameOfTheAssemblyWithoutExtension"
This has worked for me in the past.
回答5:
I met the similar issue while viewing the workflow xaml in designer view mode. It can be resolved by below steps:
- Close All Visual Studio
- Delete the hidden .VS folder
- Open Visual Studio again
- Rebuild your project
回答6:
Solved the same problem. Steps:
- Update Visual Studio.
- Close/open it.
- Rebuild.
回答7:
I got the same issue. I found, that the project with the control was not included in the solution (.sln file). Simple adding the project to the solution fixes the issue.
回答8:
Do not use a UNC path for your project folder but map a drive letter instead.
回答9:
Do not use clr-namespace syntax, use "using", for example:
change "clr-namespace:your.namespace" to "using:your.namespace"
回答10:
My Xaml issue in the same location (no converters to be clear) was a different XDG0000 and it stemmed from a cut and paste of code from OneNote into the xaml.
For some reason the pasted text ended up with hidden characters(NBWS to be exact) wherever there were line breaks. By removing all linebreaks between controls and bringing the control attributes onto one line such as from:
<TransformGroup>
<ScaleTransform CenterX="0.5"
CenterY="0.5"
ScaleX="1.5"
ScaleY="1.5"/>
</TransformGroup>
to
<TransformGroup>
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
</TransformGroup>
Resolved the issues.
I present this here as an alternative to generic issues found in the .Resources
section of a xaml page.
来源:https://stackoverflow.com/questions/52606565/wpf-designer-issues-xdg0008-the-name-numerictextboxconvertor-does-not-exist