Friday 15 February 2013

wpf - Binding to a single element inside a CompositeCollection -


I am trying to create a list of servers to browse on a network, such as it's a tree Produces a scene that looks like this:

- Local Server - End point 1 - End point 2 - Remote - & lt; Double-click to add a server ... & gt; - Remote server 1 - End point 1 - End point 2 - Remote server 2 - End point 1 - End point 2

My view model looks like this:

  ... public server local server; Public supervision & lt; Server & gt; RemoteServers; ...  

So, how is it known about creating a list in XML with bindings for a list of an object and objects? I am completely wrong about this, but what my mind really wants to do is something like this:

  & lt; Compositecollection & gt; & Lt; Single element content = "{binding lockser}" & gt; & Lt ;! - ^ ^ On the lines of a content presentation - & gt; & Lt; TreeViewItem header = "remote" & gt; & Lt; TreeViewItem.ItemsSource & gt; & Lt; CompositeCollection & gt; & Lt; TreeViewItem Header = "& amp; lt; Click to add ... & amp; gt;" / & Gt; & Lt; Archive archive = "{binding remote server}" /> & Lt; / CompositeCollection & gt; & Lt; /TreeViewItem.ItemsSource> & Lt; / TreeViewItem & gt; & Lt; / CompositeCollection & gt;  

I think that should be the basic element which I am remembering which prevents me from being able to specify what I want here. Children in that single item I tried to use a ContentPresenter, but for whatever reason, it picked up the HierarchicalDataTemplate to display correctly, although it was not expandable. Update

For now, I have exposed a property on this visual model that wraps one element into one A archive dialogue could force him to. I really would like to hear people's views on how to do this, though. This is very basic.

I have posted your questionable question regarding the composite resolution:

This is clearly a bug in WPF, whether it is trust or not here is a post accepted by an MS employee as much:

Composite compilation is not free, but should be. This makes it difficult to add non-stored elements to a collection. This is a common scenario for many things, for example, the "One One One" element above Cambodia filled with other database objects will be good, but you can not declare it in a declarative way.

Anyway, I'm sorry it's not the answer, but hopefully it helps you to see why this is not working so that you thought about it.


No comments:

Post a Comment