I need to get the insertion point (where the blinking cursor is in relation to the text) in a row of a XamDataGrid. I need to insert text at that point.
Anyone know how to get the insertion point?
Hello Jeremiah,
Thank you for your feedback. I am glad that i helped you to resolve your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thank you, that got me pointed in the right direction.
I have attached the solution to my problem for anyone else that happens to need it.
I apologize that I have misunderstood you. I have been looking through your post and sample and I edited, so now the Caret is saved. Also I can say that the editor cannot remain in edit mode, because when you click on the first XamDataGrid the second one loses focus and the editor ends its EditMode, but I save the Caret’s Position in the EditModeEnding event and you can use it in the first XamDataGrid’s MouseDoubleClick event. Also I used the GetDescendantFromType method of the Utilities class to get the XamTextEditor. In the future I suggest you use this class, when you want to get an element’s parents or children.
Feel free to write me if you need further clarifications on this matter.
This is not what I am looking for. It did get me pointed in a general direction. I've attached a project that shows you what I am trying to - minus the problem spots.
I'll need to insert the text inside the CellValuePresenter at the current cursor's position. This is not a simple 'replace the entire text'. I've found the target XamTextEditor control and can get the SelectionStart but the problem is, if I am editing in xamDataGrid2, then move up to xamDataGrid1 to do the 'double-click' the cell in xamDataGrid1 (or the entire datagrid) looses focus, exits editmode and the caret position (SelectionStart property) gets set to 0. I need the control to stay in edit mode when focus is lost.
Please see the attached project, I am traversing the visual tree to get the XamTextEditor. A secondary problem is traversing this tree. If you know of a faster way to get to the XamTextEditor please let me know.
I created a sample project for you with functionality you want. Basically I handled the MouseDoubleClick event of the first XamDataGrid and if it was raised from one of its Cells I set this value to the second XamDataGrid’s AddNewRecord’s first Cell. Please let me know if this is what you are trying to achieve or I have misunderstood you in some way..
Looking forward for your reply.