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

How to bind grid cells to custom data types

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sean Wright
Top achievements
Rank 1
Sean Wright asked on 27 Apr 2011, 04:56 PM
Hi,

I have a RadGridView with several GridViewData columns. The user is meant to input values into those columns, however, some of the columns are supposed to be bound to fields that have custom data types. For example, I have a column in the Grid called "Length." The "Length" data type in the code behind is of a custom type called "Quantity." Therefore, the value entered in the "Length" column needs to be somehow converted to a type of Quantity. But I cannot figure out how to do such binding in the xaml code, or how to use a combination of the xaml code and C# code-behind to do this.

I have other custom data types for various fields in this grid, as well. So, I need to know how to bind those grid columns in such a way that the values input into them will be converted and thus accepted by the custom types in the code-behind.

Thank you in advance.

Sean

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 28 Apr 2011, 06:48 AM

Hi Sean Wright,

You could try using converters which will convert a text in a TextBox to your underlying data types. More information about Binding and Converters can be found here

Once the converters are implemented just add them to the DataMemberBinding properties of your columns.



Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Sean Wright
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or