I need to make a budget application on winform, and the user wants a horizontal tree navigation like a show in the image, Is there a control with that functionality ?
Best Regards,
Alejandro Castrejon
Actually... the UltraWinGrid does have a horizontal ViewStyle. It's not exactly like what you have here, because the rows will appear below the parent node, not vertically centered like in your screen shot. But it is a horizontal view where the child rows appear to the right of the parent. This is what the grid's horizontal view looks like.
And I have attached a small sample project that I used to create this image.
WindowsFormsApplication44.zip
Hi Mike, I'm the same user how create this post, but i just bought the new Ultimate version 18.2 and create this new account for that keys.
Your example was the best solution, really thanks you, this is how see now:
If some in the forum need some solution I will love to share the code, just ask.
In this moment I have a couple of questions, in your example you use a UltraDataSource to populate the grid, my tree will have a dynamic structure and its populate from a SQL database and I have the following columns:
This is the first time than I use the UltraDataSource and my questions are:
I will appreciate your help.
Best regards,
To answer your question, populating the UltraDataSource manually would look something like this:
var rootBand = this.ultraDataSource1.Band; rootBand.Key = "Root Band"; rootBand.Columns.Add("Id", typeof(int)); rootBand.Columns.Add("Name", typeof(string)); rootBand.Columns.Add("BackColor", typeof(Color)); var childBand = rootBand.ChildBands.Add("Child Band"); childBand.Columns.Add("Id", typeof(int)); childBand.Columns.Add("Name", typeof(string)); childBand.Columns.Add("BackColor", typeof(Color)); for (int i = 0; i < 3; i++) { var parentRow = this.ultraDataSource1.Rows.Add(new object[] { i, "Name" + i.ToString(), Color.Blue} ); for (int j = 0; j < 3; j++) { var childrow = parentRow.GetChildRows("Child Band").Add(new object[] { j, "Name" + j.ToString(), Color.Red }); } } this.ultraGrid1.SetDataBinding(this.ultraDataSource1, "Root Band");
Hi Alejandro,
If you are binding the grid to a hierarchical data source that's coming from SQL, then you would probably be better off off using a DataSet rather than UltraDataSource. The DotNet framework has classes to populate a DataSet from SQl using the DataAdapter class.
UltraDataSource is really for when you want to create the structure and populate all of the data up-front manually. You could get your SQL data and copy it into an UltraDataSource, of course. That might be useful in some cases, since UltraDataSource is a bit more efficient when it comes to getting the child rows. But that's a trade-off in both getting all of the data up-front and also making it more difficult to update the back-end.