Reputation: 2274
I have a treeview that is bound to a database table. Each treeview item will be a grid that will have in it's first column a display name, and then a variable amount of columns containing a text box (This will depend on the amount of distinct values found in one of the columns). I've heard that a custom control would be a good choice to accomplish this, but even after looking at some tutorials online I'm having a hard time figuring out where to start with this.
Thanks!
Upvotes: 1
Views: 694
Reputation: 2274
Found out how to get it done! WPF Programmatically create treeview itemtemplate/columns
Upvotes: 1
Reputation: 7958
You should first use HierarchicalDataTemplate like this:
<HierarchicalDataTemplate ItemsSource="{Binding YourDataTimeChildNodes}" DataType="{x:Type YourDataType}">
<Grid>
<TextBlock Text={Binding YourData}/>
<TextBox Text={Binding YourData2}/>
And other stuff
</Grid>
</HierarchicalDataTemplate>
Upvotes: 0