.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > nested listbox and templates
 

nested listbox and templates

hello.

I have a listbox that each of its listboxitem is a template that also have a listbox inside of it.

i have a IsSelected property on the inner listboxitems and my goal is that only one listboxitem is selected at a given timem accross all the listboxitems in the page.

for some reason when i bind the listbox to the datacontext the first item in each inner listbox is selected.

any ideas or need iadd more information ?

mooshon78

It would be good to at least see the style for the ListBoxItem that contains the embedded ListBox. What do the bindings look like?

How are you going to impose/coordinate this concept of a single selected item across all the ListBoxes?

A TreeView already gives you the notion of single selection and might be more applicable to your scenario. The level 1 children represent the current items of your outer ListBox and each set of level 2 children represent an inner ListBox (children of a level 1 child). You could probably style a TreeView to look exactly like your current scenario also.

Dr. WPF

It would be good to at least see the style for the ListBoxItem that contains the embedded ListBox. What do the bindings look like?

How are you going to impose/coordinate this concept of a single selected item across all the ListBoxes?

A TreeView already gives you the notion of single selection and might be more applicable to your scenario. The level 1 children represent the current items of your outer ListBox and each set of level 2 children represent an inner ListBox (children of a level 1 child). You could probably style a TreeView to look exactly like your current scenario also.

Dr. WPF

thx. might give it a try. good suggestion.

mooshon78

You can use google to search for other answers

Custom Search

More Threads

• GridViewRowPresenter not working anymore!!!
• How to serialize a SystemColor by its name and not its hex value?
• Sizing content to Parent StackPanel
• How to load an XPS document into DocumentViewer using an XPS file using a Stream?
• Sorting a Column of DateTime
• xbap site of origin
• How to reverse item flow?
• Performance issue using animation and rotate transform
• Scrollviewer, with grid added through code, doesnt show scrollbars.
• ObservableCollection -- SerializationException was unhandled