Thursday, July 19, 2012

WPF Expander Databound with Nested ListBox Databound

In this article we are going to discuss how to setup an Expander that is databound with a nested ListBox that is also databound.

First we need to setup the expander or ItemsControl
This will allow for a expander with a nested listbox control. Each of the controls are bound to the collection

Next we need to set the DataContext of the ItemsControl in code with the following.

The final result is a dynamic expander acting like a group with a dynamic listbox in each expander. I am using this control as a basic navigation and call to load several different DataGrid calls.


I have loaded a coding example below: