locked
The name “XYZ” does not exist in the namespace

    Question

  • I was getting error "The name “XYZ” does not exist in the namespace " at here

    <UserControl.Resources>
        <ms:VisiableConverter x:Key="VisiableConverter"></ms:VisiableConverter>
    </UserControl.Resources>

     How to solve?

      namespace DictionaryApp.Model
    {
        public class VisiableConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }
    
            public object Convert(
            object value,
            Type targetType,
            object parameter,
            CultureInfo culture)
            {
                bool visibility = (bool)value;
                return visibility ? Visibility.Visible : Visibility.Collapsed;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }
    
            public object ConvertBack(
                object value,
                Type targetType,
                object parameter,
                CultureInfo culture)
            {
                Visibility visibility = (Visibility)value;
                return (visibility == Visibility.Visible);
            }
        }
    }
    
    
    
    Next, add the converter in the UserControl's resources. In m

    y simple project, I had to create this section - but hopefully you're already using this in your real apps!

    You may also need to add an xmlns attribute in page.xaml for your project's namespace.

    x:Class="DictionaryApp.PageDictionary"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DictionaryApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ms="using:DictionaryApp.Model"
    mc:Ignorable="d">
    <UserControl.Resources>
        <ms:VisiableConverter x:Key="VisiableConverter"></ms:VisiableConverter>
    </UserControl.Resources>


    Sunday, April 12, 2015 10:56 AM

Answers

  • I think the not implemented exceptions could be causing the issue.  I would implement this functions also

      public object Convert(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }
    

    and 

            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }

    Sunday, April 12, 2015 12:49 PM

All replies

  • I think the not implemented exceptions could be causing the issue.  I would implement this functions also

      public object Convert(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }
    

    and 

            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }

    Sunday, April 12, 2015 12:49 PM
  • I want be make lost #f5f5f5 background of gird when it no having data.How? I used to IConverter but it still that.



    Sunday, April 12, 2015 1:25 PM