A
A
Anton_repr2019-10-28 18:08:28
WPF
Anton_repr, 2019-10-28 18:08:28

Grid resources not working. What to do?

I created several classes with my own methods, but I can't connect them. Here is my code:

using System;
using System.Globalization;
using System.Windows.Data;

namespace WeirdShit
{
    public class Bool2String : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool what = (bool)value;
            if (what)
                return Properties.Settings.Default.FilledHeart;
            else
                return Properties.Settings.Default.EmptyHeart;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value.ToString().Contains(Properties.Settings.Default.EmptyHeart))
                return value;
            else
                return true;
        }
    }

I'm trying to connect:
<Grid.Resources>
            <local:Bool2String x:Key="star"></local:Bool2String>
        </Grid.Resources>

Gives the error "the name doesn't exist in namespace". I've checked everything and can't find the error. Help me please

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question