Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
For a scheduler, I want to display several times the same object (listbox) at different places in a canvas.
For example, I need to display 10 times the same listbox. For the moment, I create 10 listboxes with the same ItemSource object.
It works fine, but when I add/remove items in my ItemSource object, It can be very slow.

I've tried to put the same listbox in several ContentPresenter, but I have an error "Object has a logical child of an other parent".

So how can I have same object in different place of the VisualTree?

Thanks for response.
Philippe
Posted

Philippe MARINUTTI wrote:
I've tried to put the same listbox in several ContentPresenter, but I have an error "Object has a logical child of an other parent".

So how can I have same object in different place of the VisualTree?


The error means what it says, and it means you cannot.
 
Share this answer
 
I do not think you can do this but you can cheat a bit this using the visual brush. If you want an example, I use that technique in my PolyStar - WPF Polygons and Stars article.
The article works with a graphic object but in your case you could probably have one real on that you move around to be the one that is being interacted with and the rest could just be rectangles. It is a bit of work but this is a high performance solution. I hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900