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

[Solved] Custom ValueConverter

1 Answer 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lawrence
Top achievements
Rank 1
Lawrence asked on 16 Mar 2009, 08:49 PM
I would like to use some custom value converters with data I am displaying in the gridview.  I am able to use them in a custom column style /control template scenario, but I would also like to use them in place of the DataStringFormatter or in a similar way.

<

 

grid:GridViewDataColumn 
    HeaderText
="Media Type" 
    DataFormatString="{}{0:c}"

 

 

 

 

 

    DataMemberPath="MediaType" />

I would like the ability to use like this:
    

 

<grid:GridViewDataColumn 
    HeaderText
="Media Type" 
    DataFormatString="{}{0:c}"

 

 

 

 

 

    DataMemberPath="MediaType"
    DataConverter="{StaticResource DataConverter}"/>

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 18 Mar 2009, 01:34 PM
Hi Lawrence,

What you need here is to use the DataMemberBinding property of the column and feed it with your converter.

I have prepared a small sample. It illustrates a way to use a custom value converter for displaying values in cells.

Please see the attached project.

Sincerely yours,
Pavel Pavlov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or