Custom dependency property not working

I have a panorama control whose data template is as follows: -

   <DataTemplate x:Key="DataTemplateCategory">
            <Grid >
                <localControls:PanoramaItem BookmarkedTopics="{Binding Path=BookmarkedTopics,ElementName=root}" Topics="{Binding Topics}"/>
            </Grid>
        </DataTemplate>

The root is the name of the usercontrol in which the panorama is defined. and BookmarkedTopics in Path - DependencyProperty in the root (usercontrol), the definition of which is as follows: -

  public static readonly DependencyProperty BookmarkedTopicsProperty = DependencyProperty.Register("BookmarkedTopics",
           typeof(ObservableCollection<Topic>), typeof(MainPage), new PropertyMetadata(new ObservableCollection<Topic>()));
        public ObservableCollection<Topic> BookmarkedTopics
        {
            get { return GetValue(BookmarkedTopicsProperty) as ObservableCollection<Topic>; }
            set
            {

                SetValue(BookmarkedTopicsProperty, value);
            }
        }

BookmarkedTopics is set to MainPage_Loaded, and it is never an empty or empty collection (not relevant to my question, but still thought of mentioning it). BookmarkedTopics is the Dependency property in PanoramaItem whose definition is: -

    public static readonly DependencyProperty BookmarkedTopicsProperty = DependencyProperty.Register("BookmarkedTopics",
       typeof(ObservableCollection<Topic>), typeof(PanoramaItem), new PropertyMetadata(new ObservableCollection<Topic>()));
    public ObservableCollection<Topic> BookmarkedTopics
    {
        get { return GetValue(BookmarkedTopicsProperty) as ObservableCollection<Topic>; }
        set
        {

            SetValue(BookmarkedTopicsProperty, value);
        }
    }

The problem is when the "Bookmark Topics" tab is set to "MainPage_Loaded", why is the BookmarkedTopics installer in PanoramaItem not fired? Any error you can see in the code?

Thanks in advance:)

+3
2

, Silverlight SetValue , DependencyProperty. , setter POCO .

, : -

    public ObservableCollection<Topic> BookmarkedTopics
    {
        get { return GetValue(BookmarkedTopicsProperty) as ObservableCollection<Topic>; }
        set { SetValue(BookmarkedTopicsProperty, value); }
    }

    public static readonly DependencyProperty BookmarkedTopicsProperty =
        DependencyProperty.Register(
            "BookmarkedTopics",
            typeof(ObservableCollection<Topic>),
            typeof(MainPage),
            new PropertyMetadata(null, OnBookmarkedTopicsPropertyChanged));

    private static void OnBookmarkedTopicsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        MainPage source = d as MainPage;
        ObservableCollection<Topic> value = e.NewValue as ObservableCollection<Topic>;

        // Code here to handle any work when the value has changed
    }

, null. , .

+9

, ObservableCollection , , ObservableCollection. ReadOnly ( , , ).

MSDN . http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e19f9f98-9007-4dbd-b1c4-664a511c0846/

-1

All Articles