We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Append text

Thread ID:





89432 Aug 24,2009 01:33 PM UTC Aug 25,2009 07:40 PM UTC WPF 1
Tags: GridControl
Asked On August 24, 2009 01:33 PM UTC

I have a simple question for which I don't find the answer:

How to append text inside the essential grid in a specific cell ?

When we are typing a cell; how to get the cursor position ? How to append text at the cursor position ?



Clay Burch [Syncfusion]
Replied On August 25, 2009 07:40 PM UTC

This task is not necessarily simple because the TextBox is only available as the cell is actively being edited. So, this code only applies to a TextBox CellType, and only if the cell is being actively edited.

GridCurrentCell cc = gridControl1.CurrentCell; // or this.gridDataControl1.Model.Views.First().CurrentCell;
GridCellTextBoxRenderer renderer = cc.Renderer as GridCellTextBoxRenderer;
if (renderer != null)
TextBox tb = renderer.CurrentCellUIElement as TextBox;
if (tb != null)
//set 'Apple' into the text
renderer.ControlText = "Apple";
//this code puts the cursor after the last 'p'
tb.SelectionStart = 3;
tb.SelectionLength = 0;
//insert 'xx' after last p
tb.SelectedText = "xx";


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon