I am trying to take into account the activation of a cell to decide what my own code should do. However, I am having trouble because the actual activation of the cell can be affected by multiple different properties. In my debugging sessions, I notice a ActivationResolved property on the UltraGridCell that would likely be exactly what I need, but it appears to be an internal property.
My problem mainly stems from the fact that I cannot find a way to differentiate between a cell's actual Activation being AllowEdit or ActivateOnly. I am tempted to use reflection to access this property and be done with it, but I am assuming that there is a reason it has not been made public. Am I approaching this from the wrong angle?
To give more detail on what I'm doing, I'm working with the following legacy code:
if(e.Cell.IsInEditMode == false) { return; } // <jp>日付Comboboxでデータがnullとき現在日で初期化</jp> // <en>Initializing date and time when cell value is null.</en> if(e.Cell.Value.ToString().Length <= 0 && e.Cell.Column.DataType == System.Type.GetType("System.DateTime") && e.Cell.Column.CellActivation == Activation.AllowEdit) { string fm = ((UltraGrid)sender).DisplayLayout.Bands[e.Cell.Band.Index].Columns[e.Cell.Column.Key].MaskInput.ToUpper(); if(fm.Length <= 10 && fm.IndexOf("HH") < 0) { e.Cell.EditorResolved.Value = DateTime.Now.ToShortDateString(); } else { e.Cell.EditorResolved.Value = DateTime.Now; } }
In one particular case, the Row.Activation is being set to ActivateOnly, so the cell is being poplulated even though I would like it to remain null.
I have run into this issue before, and I remember writing my own logic (though I'd have to search to find it now), but I know that it is not equivalent to the logic in the ActivationResolved property, so there are probably cases where that code would also break...
Any help would be greatly appreciated. Thank you.
Hi,
I'm not really sure why the resolved property isn't public. It was probably done just to avoid cluttering up the object model on the theory that this property would not be very useful. It could also be that the activation isn't always resolved the same way. Some circumstances might accounts for certain factors that others do not.
If your application is going to run in a full trust environment, then using reflection is probably your best bet. Otherwise, the only way to do it would be to essentially duplicate the code that resolves the activation the way the grid does.
Anyway, you're not the first person to ask for this, and it should be easy enough for us to expose the property, so I'm going to ask Infragistics Developer Support to write this up for developer review and maybe we can get it "fixed" by exposing the resolved property in a future service release.
Mike,
Thank you for your reply. I'll go ahead and make an extension method for it then (too bad they haven't gotten around to extension properties, yet ^^)
Hello Jon Scharff,
I have created case number CAS-117757-B4W5Q6 for you to assist you with your request going forward. To access the case, simply log into your Infragistics account and click on My Support Activity.
Also, I will be sure to update this forum post with the resolution as soon as it is available.
The fix for "The ActivationResolved on the UltraGridCell is not public" has been resolved in NetAdvantage 2012 Volume 2 and newer. To take advantage of this fix, please download the latest service release using the instructions found here: http://community.infragistics.com/forums/t/29398.aspx
Please let me know if you have any questions.