Hi,
I need to have multiple buttons inside a single grid cell. The buttons will be used to show a particular row in a child band. Taking an Order/Order lines example. I want the Orders table row to have a unbound column that will be dynamically filled with horizontal buttons for each Order Line row in that order. Looking at the image below, each of the 3 rows in the Order Lines column is a button that when pressed will expand the Order Lines child band that is filtered to show only that particular order line that was selected.
What I don't know how to do is:
Is this design even possible using existing editor controls?
Thanks
Mike Saltzman provides some information about putting multiple buttons in a cell in this post:http://forums.infragistics.com/forums/p/1291/11787.aspx#11787
If you want to show different buttons in different cells in the same column, then you'll need to set a individual edtior control for each cell, rather than just one for the column. In an ideal situation, if you have a finite number of button combinations (for instance, you'll only ever show no, one, two, or three buttons), then you can create a single editor control for each such combination, and connect your cells to those editors on an as-needed basis.
Off the top of my head, I don't recall whether it's an event on the grid or an event on the editor that's raised when you click these editor buttons.
I threw together a quick sample of doing this with a CreationFilter.
Mike,
How do I go about dynamically controlling the number of boxes based on a child collection? I'm pretty sure I need to do it in the InitializeRow event and access the child collection and loop the button creation code.
No, you woud still do this in a CreationFilter. If you look at the code, it's just arbitrarily creating 3 buttons per cell. But there's no reason it has to be limited to 3. You can create as many buttons are you want and arrange them however you want.
The code in the CreationFilter gets a reference to the cell object. So if you want to get the child rows, you can easily do that using cell.Row.ChildBands["child band key"].Rows.
One thing you may want to do in the InitializeRow is set the Height of the row, so it has enough room to accomodate the buttons. You will probably also want to set RowSizing (on the Override) to Free to allow each row to have a different height. I would do this in the InitializeLayout.
Everything works great Mike, but now when I'm trying to style the button it tells me that ButtonStyle is read-only.
buttonElement1.ButtonStyle = UIElementButtonStyle.Borderless;
It is read-only. But you can override it on the derived button element class. :)