GrdiViewDataColumn with converter and converterparameter with binding

6 posts, 1 answers
  1. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 22 Apr Link to this post

     <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?

  2. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 27 Apr Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 27 Apr in reply to Martin Vatev Link to this post

    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.

     

  5. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 27 Apr Link to this post

    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.
  6. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 27 Apr in reply to Martin Vatev Link to this post

    Hello Martin, for curiosity,

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

    This one hasn't DependencyProperty.

  7. Answer
    Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 27 Apr Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready