Z
Z
Zulkund2017-01-30 17:59:57
WPF
Zulkund, 2017-01-30 17:59:57

How to create dependency property in WPF via XAML markup?

Good afternoon! I'm learning WPF and I ran into this problem: I can't create a sample class through xaml markup that would contain a dependency property. Writes that there is no such class in the given namespace. fb69792285e34e96942828f43ca04409.PNG. Although this class is in the solution explorer, ad73a98ff08446c69c3e4df42998aa50.PNGtell me what could be wrong? How can it be corrected?
Class1 code:

using System;
using System.Windows;

namespace WpfDependency
{
    class Class1 : FrameworkElement
    {
        public static DependencyProperty DataProperty1;
        static Class1()
        {
            
            DataProperty1 = DependencyProperty.Register("Dataa", typeof(int), typeof(Class1));
        }
        public int Dataa
        {
            get
            {
                return (int)GetValue(DataProperty1);
            }
            set
            {
                SetValue(DataProperty1, value);
            }
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2017-01-30
@Zulkund

Did you build the project after you created the class?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question