MAUI BindableProperty(의존 프로퍼티) 생성

MAUI에서 아무생각없이 propdp + tab + tab으로 DependencyProperty를 생성하려고 했더니 안되더군요. 찾어보니 아래와 같이 바뀌었습니다.
propdp + tab + tab으로 만들고 DependencyProperty.Register => BindableProperty.Create과 defaultValue부분만 바꿔서 쓰면 될것같습니다.

MAUI BindableProperty

public static readonly Microsoft.Maui.Controls.BindableProperty IsFocusedProperty =
        Microsoft.Maui.Controls.BindableProperty.Create(nameof(IsFocused), typeof(bool), typeof(MainPage), false);

    public bool IsFocused
    {
        get => (bool)GetValue(IsFocusedProperty);
        set => SetValue(IsFocusedProperty, value);
    }

WPF DependencyProperty

 public static readonly System.Windows.DependencyProperty IsFocusedProperty =
           System.Windows.DependencyProperty.Register(nameof(IsFocused), typeof(bool), typeof(MainWindow), new PropertyMetadata(false));

        public bool IsFocused
        {
            get => (bool)GetValue(IsFocusedProperty);
            set => SetValue(IsFocusedProperty, value);
        }
2개의 좋아요

코드 템플릿으로 만들어서 써야 되겠네요.
유익한 정보 감사합니다~

2개의 좋아요