Answer the question
In order to leave comments, you need to log in
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. . Although this class is in the solution explorer, tell 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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question