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.
menziesetcd said:I will look into how/where to create CreationFilters as I am not familiar with them.
Using two editors is probably easier.
But if you want to try the CreationFilter approach, I recommend that you get the Infragistics UIElementViewer Utility. It will be a big help.
Thanks Mike.
I will look into how/where to create CreationFilters as I am not familiar with them.
On the issue of closing the dropdown, i did implement a workaround where I simply set the focus back to the originating cell which worked ok. I will look into your suggestion of DropDownManager and Closup as that may be a more elegant solution.
Many thanks.
menziesetcd said:Is there absolutely no way, to have a button which displays on mouse enter and with CellActivation ActiveOnly to avoid in-situ editing of the cell?
I was not able to find a way to do this. But you could use a CreationFilter to remove the button for cells in which it should be disabled. Or you could even use a different editor on those cells - like an UltraTextEditor with no buttons.
menziesetcd said:The second issue was that my user control editor has a Apply button which user must click to save any changes to database. So when Apply is clicked, I need to simulate the normal behaviour that occurs when the user cancels/completes a cell dropdown edit. I tried hiding the usercontrol, but am then left with an empty gray panel of size/location of the "hidden" user control which only goes away if I click elsewhere in the grid.
You just need to close the dropdown. If you have a reference to the cell, you can use cell.EditorResolved to get the editor, then cast that into an EmbeddableEditorButtonBase and then get the ButtonsRight collection. Once you have that, there's a CloseUp method on the button.
Another alternative is to use the static CloseUp method on the DropDownManager which will close any open dropdown windows. Typically, this is okay, since there is usually only one dropdown open at a time.
Hi Mike
I tried your idea of using an UltraTextEditor with a DropDownEditorButton to launch a custom user control. I had two issues. The first, as above, is the problem that the button only works if display style is Always - this looks awful in a grid with multiple editable columns, expecially as the edit-capability of each cell is conditional on other data in each row, and havng the button always display looks very cluttered. Is there absolutely no way, to have a button which displays on mouse enter and with CellActivation ActiveOnly to avoid in-situ editing of the cell?
The second issue was that my user control editor has a Apply button which user must click to save any changes to database. So when Apply is clicked, I need to simulate the normal behaviour that occurs when the user cancels/completes a cell dropdown edit. I tried hiding the usercontrol, but am then left with an empty gray panel of size/location of the "hidden" user control which only goes away if I click elsewhere in the grid.
Any hints will be much appreciated.
Great suggestion. Changing my project since I will likely have to do this multiple times as the users gets used to the cell interface and want it on other screens. (Plus it enhances the functionality as you pointed out).