Binding to a single element inside a CompositeCollection

前端 未结 4 811
清酒与你
清酒与你 2020-12-11 05:58

I am trying to produce a list of servers for browsing on a network such that it produces a tree view which looks like this:

-Local Server
 - Endpoint 1
 - En         


        
4条回答
  •  旧巷少年郎
    2020-12-11 06:26

    I posted a question very similar to yours regarding CompositeCollections: Why is CompositeCollection not Freezable?

    This is apparently a bug in WPF, believe it or not. Here's a post by an MS employee admitting as much: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b15cbd9d-95aa-47c6-8068-7ae9f7dca88a

    The CompositeCollection is not freezable, but should be. This makes it difficult to combine nonstatic elements into one collection. It's a common scenario for a lot of things. For example, a "Select One" element at the top of a combobox filled with other databound objects would be nice, but you can't do it declaratively.

    Anyway, I'm sorry this is not an answer, but hopefully it helps you see why this isn't working how you thought it should.

提交回复
热议问题