I'm getting "The name xxx does not exist in yyy" all the time. I don't understand why, i think i tried all possible combinations.
All of my cs file, including main window are in "Web_Media_Seeker_WPF" namespace
Converters.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Web_Media_Seeker_WPF.WPFConverters
{
public class BoolToValueConverter<T> : IValueConverter
{
public T FalseValue { get; set; }
public T TrueValue { get; set; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return FalseValue;
else
return (bool)value ? TrueValue : FalseValue;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value != null ? value.Equals(TrueValue) : false;
}
}
public class BoolToObjectConverter : BoolToValueConverter<Object> { }
public class BoolToStringConverter : BoolToValueConverter<String> { }
public class BoolToBrushConverter : BoolToValueConverter<System.Windows.Media.Brush> { }
public class BoolToVisibilityConverter : BoolToValueConverter<System.Windows.Visibility> { }
public class BoolToColorConverter : BoolToValueConverter<System.Windows.Media.Color> { }
public class BoolToImageSourceConverter : BoolToValueConverter<System.Windows.Media.ImageSource> { }
public class BootToBoolConverter : BoolToValueConverter<bool> { }
public class AddValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
object result = value;
int Value;
if (value != null && targetType == typeof(Int32) &&
int.TryParse((string)parameter,
System.Globalization.NumberStyles.Integer, culture, out Value))
{
result = (int)value + (int)Value;
}
return result;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
MainWindow.xaml
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namesapce:Web_Media_Seeker_WPF.WPFConverters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Web_Media_Seeker_WPF.MainWindow"
Title="Web Media Seeker"
Height="563"
Width="836">
<Window.Resources>
<local:BoolToImageSourceConverter x:Key="BoolToWorkImageSource"
TrueValue="Images/work.png"
FalseValue="Images/idle.png" />
<local:BootToBoolConverter x:Key="InvertBool"
TrueValue="False"
FalseValue="True" />
<local:BoolToStringConverter x:Key="WorkTooltip"
TrueValue="Working..."
FalseValue="Idle" />
</Window.Resources>
and stuff...
Errors i have:
The name "BoolToImageSourceConverter" does not exist in the namespace "clr-namesapce:Web_Media_Seeker_WPF.WPFValuesConverters".
The name "BoolToStringConverter" does not exist in the namespace "clr-namesapce:Web_Media_Seeker_WPF.WPFValuesConverters".
The name "BootToBoolConverter" does not exist in the namespace "clr-namesapce:Web_Media_Seeker_WPF.WPFValuesConverters".
The tag 'BoolToImageSourceConverter' does not exist in XML namespace 'clr-namesapce:Web_Media_Seeker_WPF.WPFValuesConverters'.
The type 'local:BoolToImageSourceConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
The type 'local:BoolToStringConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
The type 'local:BootToBoolConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
There's an error in your namespace declaration:
xmlns:local="clr-namesapce:Web_Media_Seeker_WPF.WPFConverters"
should be
xmlns:local="clr-namespace:Web_Media_Seeker_WPF.WPFConverters"
You put namesapce
instead of namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With