Does anyone have an example or idea on embedding a user control within the cell (not drop down editor button) of a cell?
Currently I'm instantiating the usercontrol at runtime from class inheriting EmbeddableEditorBase, but I can't seem to get
the control to paint within the cell. I am also new to the Embeddable Editor archtecture so if anyone knows any good reference
sites that would be helpful. Thanks!
Thanks for your reply.
I looked into the DrawForeground method, which calls render method which inturn calls Render Helper method but nowhere they are getting the UltraGridCell object to display the value into the cell. As you mentioned, i tried to read the cell value, and it has the next subsequent cell value. (but its surprising that why it is not getting displayed though i hav the cell value of subsequent cells.)
But to recreate the issue in RichTextEditor sample code provided by Infragistics, i just comment out the below metioned line in RenderingHelper method in EmbeddableRichTextBox.cs file,
"SendMessage(handleRefHwnd, EM_DISPLAYBAND, IntPtr.Zero, ref fr.rc);"
From this, it is clear that they are getting the "RichTextBoX" handle (handleRefHwnd) and they display the value in the cell by sending EM_DISPLAYBAND message (This message is to display the value of the richtextbox). CORRECT ME IF I'M WRONG
So, to display the value in the Masked Edit box in the UltraGridCell what should be the message i need to pass (as like EM_DISPLAYBAND for RichTextBox) or if not possible through SendMessage how can i display the value in the Text in the UltraGridCell (i.e, how can i render MaskedEditBox) ?
It will be really helpful if u provide some solution for this.
Thanks..
I had a similar problem. Make sure your DrawForeground override in the EmbeddableUIArea class is correctly rendering your cell value. You
((CellUIElement)embeddableElement.OwnerContext).Cell;
After going through the rtf sample (and some help from support) I found the solution. Basically the User Control has to be reparented and re-positioned in the OnBeforeEnterEditMode event. To make a long story short this done using the Controls.Add functionality. I did this in GetEmbeddableElement override.
owningControl.Controls.Add(myControl);
}
Basically the rtf sample can be retrofitted to support any type of control. Simply replace the RichTextBox instantiation with your own. This is can be a very meticulous process and you want to make sure your class structure matches exactly as the rtf sample.
Another snag I ran into was the the OnBeforeEnterEditMode didn't fire after adding the edit area to ChildElements (add function). This was because I was not forwarding my mousedown event from the UIElement (see InternalOnMouseDown if you experience this).
You will not need any of the rtf render logic so you can skip all that logic. But you will have to write your own render code
to display the graphics in the drawforeground override (*edit see other messages)
Thanks for the quick reply and suggestion! Going to review the sdk. I will let you know if that works out.