locked
Binding doesn't work properly in DependencyObject inheritor RRS feed

  • Question

  • Hi,

    I've encountered the following problem:

    1) There is an inheritor of DependencyObject  with some DependencyProperties - for example, it's called CustomItem.

    2) There is a list of objects or interfaces and we put CustomItem instances in this list. On form there is ItemsControl, that shows this list.

    3) And here the problem is occured: Binding on CustomItem properties don't work until we declare any public property of CustomItem class in any visual component.

    Project Samples

    1) Launch project and click "Change Items Visibility" - Visibility of borders don't changed

    2) For sample 1, 2 - uncomment line 14 in MainPage.xaml.cs, for sample 3 - uncomment <!--<local:CustomGrid/>--> in MainPage.xaml

    3) Launch project and click "Change Items Visibility" - bindings work fine.
    Win 8.1, VS2013

    Tuesday, December 3, 2013 6:48 AM

Answers

  • I believe this is by-design, but I can't recall the reason for it.  Does it pose a problem?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 3, 2013 8:18 PM
    Moderator

All replies

  • I believe this is by-design, but I can't recall the reason for it.  Does it pose a problem?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 3, 2013 8:18 PM
    Moderator
  • I believe this is by-design, but I can't recall the reason for it.  Does it pose a problem?
    For now it doesn't. But because of this behaviour I'd had several bugs in real projects and it took some time to identify cause.
    Wednesday, December 4, 2013 1:54 PM