gpt4 book ai didi

c# - WPF 设计器问题 : XDG0008 The name "NumericTextBoxConvertor" does not exist in the namespace "clr-namespace:PulserTester.Convertors"

转载 作者:行者123 更新时间:2023-11-30 17:28:35 30 4
gpt4 key购买 nike

我有一个错误,不允许我看到我的设计师..但我在构建时没有错误,我的程序运行正常,没有问题

我尝试过:

  • 清理和重建
  • 更新 Visual Studio
  • 修复 Visual Studio
  • 重启我的电脑

没有任何帮助。我不知道我还能做些什么来解决它。

我必须尝试在此处查看,即使在重新启动 visual studio、重新构建解决方案后也没有为我工作

the name <...> does not exist in the namespace clr-namespace <...>

这是我的错误:

enter image description here

这是 Xaml 文件:

<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>

这是我的转换器:

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;
}
}
}

最佳答案

我只想重申一个解决方案 Bradley Uffner提埋in the comments above .

  1. 关闭 Visual Studio

  2. 删除隐藏的.vs文件夹

  3. 打开 Visual Studio 并重建您的项目

请记住,这是一个非常普遍的错误,有多种原因和解决方案,因此这可能对您不起作用,但绝对值得一试,因为我知道它在过去曾多次对我有用。

关于c# - WPF 设计器问题 : XDG0008 The name "NumericTextBoxConvertor" does not exist in the namespace "clr-namespace:PulserTester.Convertors",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52606565/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com