I need to dynamically set a column in an UltraDropDown based on a value in the UltraGrid row from which it is being dropped. In other words I want to get a reference to either the UltraGridRow or the UltraGridCell which was clicked on, to use in the InitializeRow event of the UltraDropDown.
It isn't an parent control and I can't seem to find any combination of UIElements which would help out.
Things like
UltraDropDown u = UltraDropDown(sender);
UIElement element = u.DisplayLayout.UIElement;
element.GetAncestor(....... GetContext(.
None of the above lead anywhere. Other than a hoaky getting a client by assuming the point is above the dropdown and using something like ElementFromPoint, does anyone have any way to get the UltraGrid row or cell dropping down the list?
Hmm after posting this, I realized that the cell and row should be active, so I should be able to get them indirectly. Be better of course if there was a more direct way.
Hi,
I don't think this will work, even using the ActiveCell. InitializeRow is only going to fire the first time the rows of the dropdown are initialized, not every time you drop it down. Also, if you change the values of either the DisplayMember or ValueMember columns on the list, this will end up affecting other cells in the grid column, because they may no longer be able to translate values.
Perhaps if you could explain in a little more detail exactly what kind of functionality you are trying to acheive, I might be able to offer you a suggestion for a better way to do it.
Thus the datasource for every row's dropdown was different. And thus the IntializeRow fired every time the UltraDropDown was dropped down. And I was able to get the value from the grid.ActiveCell.Row.Cells["xxx"] that I needed.
Although this is solved, it would be interesting to find out if there is a way to refer to the cell that dropped down the list from the UltraDropDown since it's not a parent relationship, but in fact the cell can be pouplated by the dropdown ValueMember and DisplayMember if a row is selected, so there is some relationship. (in my case I did not want the cell populated, since the ultradropdown was informational only and purposely set up so that the ValueMember and DisplayMember was not set).