Hi,
I would like to make a table to display data in, with headers along both the X and Y axes, instead of just the X axis like a typical ultragrid. The values in the cells would just be boolean - matching up certain X and Y values together. (The X's in the cells would represent True, empty cells are False)
Here's an example:
Is this possible to do with the ultragrid?
It could potentially work for me to use the row selectors for my Y values if I can write my own text in them.
I also had thought about turning off the row selectors, and just using the first column in my grid for the Y values (and making it so selecting a cell in that column would select the whole row).
Both of these seem like hacks to me, and I'm afraid they'd just lead to more trouble than they are really worth.
Does anyone know if there's a way to set up the grid in this manner? Does anyone know of another control that would be better suited for this?
Thanks!
There are no built-in row headers in the grid. Either of the solutions you suggest here seem perfectly reasonable to me, though.
Personally, I would probably go with a column, rather than try to use the RowSelectors. Using the RowSelectors is possible, but it won't be able to do some thing that a regular column can do like sorting or auto-sizing.
I started making a custom control that implemant that, but I have some problems.
The purpose is to show an m:n relationship.
For example:
My idea is:
One problem I have before I can check my code is how do I know when data binding complete. MS grid has an event for that and I could use one if UltraGrid had any. I can use the InitializeRow but it fires for each row and I want to add the columns only once, and it fires before I set my added properties.
I attached the sample. It's quite messy and only the first draft and it works with Linq2Sql.
You can change it to fit your scenario or any scenario.
I don't understand. Why do you need to know when data binding is complete? There is no such event in the grid because data binding is really never "complete". Binding is a continuous process where the grid stays in synch with the data source.
Also, I really don't see what this has to do with the original poster's question about creating a row header. This seems like a completely different issue - although you probably want a row header, also.
Hi Mike,
I want to create a CustomControl that gets the extra information to set the matrix and after it populates the rows it would put the extra headers and fill the data, so for that I need to know when the exact point after the grid is populated.
If I don't know that, I need to explicitly call the method that adds the columns and fills the data from the class that hosts the CustomControl, after it filled the extra information.
MS's DataGridView has that:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.databindingcomplete.aspx
Ofcourse, UltraGrid is much better than DataGridView and that's why I'm using it.
I'm still a little unclear on what you need here. After you set the DataSource property of the grid, the grid will create all of the columns and rows. So you don't need an event, you can simply examine the structure of the grid on the next line of code. Or... you could examine the data source, rather than the grid.
Yes, I could do that ofcourse, but think that the user will set the extra information by designer (if I had a type converter), and then set the data source. If I want to make my control simple, he shouldn't be need to invoke anything else, like you don't need to do anything after you set the datasource of a normal grid.
Never mind, I can do it like you said anyway.