The ListBox contain开发者_开发技巧s multiple ListBoxes which inturn contain many ListBoxItems. The top level ListBox does not have a ItemsSource collection bound to it, rather the child ListBoxes have ListBoxItems that are bound to individual properties in the VM. Is there a way to just dump the ListBox "contents" to an Excel file, may be by converting them to an XML format first??
You should be able to translate this post on exporting a datagrid to Excel to your list box scenario. In your case you will need to walk the control tree to find the children of each child (probably in a recursive manner) and then render it to Excel using xml.
精彩评论