[WP7] DependencyPropertyChanged fires twice on cached view

Topics: Bugs
Oct 23, 2012 at 6:26 PM

I have a dependency property on my view:

public static DependencyProperty AutoFollowProperty = DependencyProperty.Register("AutoFollow", typeof(bool), typeof(Page2View), new PropertyMetadata(false, OnAutoFollowChangedCallback));

        public bool AutoFollow
            get { return (bool)GetValue(AutoFollowProperty); }
            set { SetValue(AutoFollowProperty, value); }

        private static void OnAutoFollowChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)

        private void OnAutoFollowChanged(DependencyPropertyChangedEventArgs e)

        public Page2View()

            Binding b = new Binding("AutoFollow");
            b.Source = DataContext;
            SetBinding(AutoFollowProperty, b);

when i navigate to this view second and other times, changing property in VM fires OnAutoFollowChaged twice.


Alexander Kalinovsky

Oct 23, 2012 at 8:39 PM

Self answered: As this binding performed manually (not conventions), I should check for existing binding.

But still it is strange, why does it fire only twice, though view activated more then 2 times...