I'm working on a software to display some Database structure. I'm using SMO to retrieve Information about tables, Vies an Procedures. The Object Structure is as follows:
- Database
- Tables
- Views
- Procedures
I retrieve some database objects, which contain Collections of Views, Tables and Procedures.
What I want to do know is populate a TreeView with the different Collections. The first Level of TreviewItems would be dynamic and display the Databases. In the second level (under the databases) would be three static Items. These would be named "Tables", "Views" and "Procedures". Each of these subitems should be populated by one of the Collections in the database object. I've tried the following code:
This code works nearly as expected but has the problem that you can't select any items. It seems like the problem occurs due to the TreeViewItems that I'm adding to the TreeView. In another thread I've read, that you should just add TextBoxes (or other controls) since the TreeView automatically surrounds them with a TreeViewItem. But How can I add Subitems to these TextBox-"Items"?
Thanks in advance :-)
Romano ZumbePosted Mar 12, 2013, 9:31 AM
thank you for your quick answer. Unfortunately this doesn't solve my problem, since all the logic is done in code. I need a way to achive this by pure XAML.
Vishal GilbilePosted Mar 12, 2013, 6:06 AM
The following link may help you with your problem.
http://www.c-sharpcorner.com/UploadFile/17e8f6/treeview-and-wpf-user-control-in-wpf/
With Regards,
Vishal Gilbile.