Hi,
I have UI which is having two ultra grids placed like top and bottom. Both grids are Cardview setup and if user resize the column width of the top grid i have to resize the bottom grid column width as well so that the UI looks consistence.
For the above scenario i'm trying to capture the column resize event "AfterColPosChanged" but it's not getting triggered when the grids are in cardview but in the default view it's triggered.
Please help me on subscribing the appropriate event for column resize event in cardview or an approach to achieve it.
Regards,
Sundaram
Thank you for your quick reply. Now i got the implementation of cards width update and when i change the card width in the CardSettings it is updating for all cards.Thanks again.
There is no column. In CardView, columns and rows are reversed. So there is no column being resized here. If anything you would be resizing a row. But in the default case, that's not true, either, since ALL of the cards are resized.
If there was a single row or column involved, then you can probably find it using the propChange passed into the event args. propChange has a property on it called Trigger. The Trigger property returns the propChange for the subObject that triggered the changed. So if you were to resize a single column in a non-CardView grid, the ultimately trigger would be the Width property on the Row and that would bubble up to the band and then to the layout and then to the grid.
But like I said, unless you are somehow changing your CardSettings in such a way that each card has a different width, there is no sub-object here. You are essentially just setting a single property that affects ALL cards.
Hi Mike,
As i mentioned earlier i was looking for the LabelWidth that is working fine for one of my requirement.
the other one which i'm looking for is the ColumnWidth changes, I can use the same approach for getting the column width changes but in have to identify which column is updated so that in the other grid i can update the specific (i.e. the same position ) column width.
Is there any way to identify which column is changed (or) the index of the column details.
Thanks for your suggestion, that's what i expected. As per your suggestion the event is triggering once for the Card width changes.
Yes i'm looking for the LableWidth and i'm not using any RowLayouts and Styles for the cards.
Thank you for your support
You are correct that the PropertyChanged event of the grid will fire any time any property on the grid changes. Although there are certain exceptions - this event does not fire for properties of the row or cell because those would be very inefficient. But you are right to be concerned about performance here.
Your approach of using SubObjectPropChanged on the CardSettings is a good idea. But your implementation has a problem. The Band property of the column is a backward pointer. So you are getting the band (e.Layout.Bands[0]) and then looping through every column of that band, then getting the Band from the column and hooking the event. So you are essentially hooking and re-hooking SubObjectPropertyChanged on the SAME CardSettings instance once for each column in the band, and there's no reason to do that. You only need to hook it once:
e.Layout.Bands[0].CardSettings.SubObjectPropChanged += column_SubObjectPropChanged;
Also... I'm a little confused about what property Id you should be looking for here. Divya's example used Width and yours is using LabelWidth. If LabelWidth is also changing, then that's fine and I don't think it matters. But just out of curiosity, are you setting the RowLayoutStyle on the Band here? If you are, and your band is using RowLayouts, then you might be able to utilize the AfterRowLayoutItemResized event, instead of SubObjectPropChanged. But if you are not already using RowLayouts, it's probably not worth switching, since it would require a lot of changes to your existing code.