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.
Unfortunately, activation email could not send to your email. Please try again.

Append text

Thread ID:

Created:

Updated:

Platform:

Replies:

89432 Aug 24,2009 09:33 AM Aug 25,2009 03:40 PM WPF 1
loading
Tags: GridControl
Nazim YENIER
Asked On August 24, 2009 09:33 AM

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 ?

Thanks

Nazim YENIER

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

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";
}
}

CONFIRMATION

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.

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.

;