This is a migrated thread and some comments may be shown as answers.

Replace all TextBlock with another control

3 Answers 259 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ahmad
Top achievements
Rank 1
Ahmad asked on 25 Dec 2016, 06:13 AM
Hi,
I wanna replace all TextBlock controls used in RadGridViews in my application with another control.
for example: if is instead of TextBlock, use RichTextBox.
there is any way to do that?
Thanks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Ivanov
Telerik team
answered on 26 Dec 2016, 10:11 AM
Hi,

There are several different possible approaches to this task. You can create a custom column, overriding CreateCellElement. You can also use the DataTemplate support, by using CellTemplate, or CellTemplateSelector.  If the scenario requires that all TextBlocks should be replaced, I would recommend the custom column approach.
As a side note, I would like to mention that RichTextBox is a very complex control and using it in every cell of RadGridView will significantly affect performance. Can you please share what is your ultimate goal, so that we can discuss an alternative approach if it is possible.

Regards,
Ivan Ivanov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Ahmad
Top achievements
Rank 1
answered on 27 Dec 2016, 06:54 AM
Hi,
The TextBlock have some problem when you type words in different languages.
for example, if you type Arabic word first and after that, you type an English word,
it seems you type English word first.
I fix it using RichTextBox.
So I wanna use this control instead of TextBlock in RadGridView.
Thanks.
0
Ivan Ivanov
Telerik team
answered on 27 Dec 2016, 04:37 PM
Hello,

You can try using a RichTextBox, but if the performance is not satisfying enough, I would suggest that you try using a custom user control that solves the problem. Can you please confirm whether you want to display it in edit, or display mode, as you mentioned that the issue occurs when typing?

Regards,
Ivan Ivanov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Ahmad
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Ahmad
Top achievements
Rank 1
Share this question
or