0
xaml 사용자 정의 컨트롤에 대한 bool 종속성 속성을 만들었습니다. 그러나 xaml에서 값을 false로 설정하면 xaml에서 true로 설정된 경우 이벤트가 실행되지 않습니다. 어떻게해도 이벤트를 시작하려면 어떻게해야합니까?Bools의 DependencyProperties : False가 발생하지 않는 이벤트
public static readonly DependencyProperty AvailableProperty =
DependencyProperty.Register("Available", typeof(bool), typeof(DetailPannel),
new PropertyMetadata(null, onAvailablePropertyChanged));
public bool Available
{
get { return (bool)GetValue(AvailableProperty); }
set { SetValue(AvailableProperty, value); }
}
private async static void onAvailablePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var obj = d as DetailPannel;
bool avaible = (bool.Parse(e.NewValue.ToString()));
if(avaible == false)
{
obj.PreviewImage.Source = await ConvertToGreyscale(obj.PreviewImage);
obj.StateRelatedImage.Source = new BitmapImage(new Uri("ms-appx:///icon.png"));
}
}