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

GrdiViewDataColumn with converter and converterparameter with binding

5 Answers 667 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 22 Apr 2016, 03:20 PM

 <telerik:GridViewDataColumn Header="Valore" DataMemberBinding="{Binding Value,Converter={StaticResource DynamicsParameterConverter}}" />

Actually I have this column, my entity has other property called "Type", this one show me how to use a converter class.

I would change this column in this vesion

<telerik:GridViewDataColumn Header="Valore" DataMemberBinding="{Binding Value,Converter={StaticResource DynamicsParameterConverter}, ConverterParameter={Binding Type}}" Width="*" />

 

But I can't do this because ConverterParameter is not compatible with DependencyProperty, is there a workaround or feature of column for this?

5 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 27 Apr 2016, 08:05 AM
Hi Potito,

Because the ConverterParameter property is not a dependency property and hence can not be bound, an alternative solution is to use a MultiBinding with a multi-value converter instead of a normal Binding. Please take a look at Binding ConverterParameter StackOverflow article where you can find detailed information on the matter.

I hope that this helps. 

Regards,
Martin Vatev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 27 Apr 2016, 08:14 AM

I saw, thank you, finally I decided to change the nature of the property "Value", in this way I have encapsulated the value parameter, then running it into the converter.

 

0
Martin
Telerik team
answered on 27 Apr 2016, 08:28 AM
Hello Potito,

I am glad to hear that you have found a workaround for this restriction.

Regards,
Martin Vatev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 27 Apr 2016, 02:30 PM

Hello Martin, for curiosity,

but how do I use MultiBinding approach, if I have to use it on DataMemberBinding ?!?

This one hasn't DependencyProperty.

0
Accepted
Martin
Telerik team
answered on 27 Apr 2016, 03:18 PM
Hi Potito,

The best way to achieve your goal will be to declare CellTemplate for the desired column and use a simple TextBlock with MultiBinding approach for the Text property.

I hope this helps.

Regards,
Martin Vatev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Martin
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or