jimmyjambles
jimmyjambles

Reputation: 1670

Enum dependency property not working with intellisense

I have the following UserControl

public partial class TestCtrl : UserControl
{
    public enum Alignments
    {
        HORIZONTAL,
        VERTICAL
    }

    public TestCtrl()
    {
        InitializeComponent();
    }

    public static DependencyProperty AlignmentProperty = DependencyProperty.Register(
    "Alignment",
    typeof(Alignments),
    typeof(TestCtrl),
    new PropertyMetadata(Alignments.HORIZONTAL));

    public Alignments Alignment
    {
        get
        {
            return (Alignments)GetValue(AlignmentProperty);
        }
        set
        {
            SetValue(AlignmentProperty, value);
        }
    }
}

The property works but auto-complete does not detect possible values for the property when using it in xaml.

Upvotes: 1

Views: 1862

Answers (1)

jimmyjambles
jimmyjambles

Reputation: 1670

Found the answer, turns out according to this howto you need to declare the enum outside of the class with the dependency property

Upvotes: 2

Related Questions