Set Custom ItemTooltip Using MVVM

2 posts, 0 answers
  1. Martyn
    Martyn avatar
    18 posts
    Member since:
    Mar 2011

    Posted 28 Feb 2012 Link to this post


    I have a set of RadCharts each containing the standard tooltip set using the ItemTooltipFormat property.

    However, I want to customise the Tooltip control further, but, the documentation only says how to do this using the ItemTooltipOpening event, which is unsuitable for me as my project is using MVVM and so I cannot handle the event in the code behind.

    I've thought about using EventToCommand, but this is unsuitable as I can only pass one property as the command parameter this way, whereas I need both the EventArgs and the Tooltip.

    Please tell me this is possible and how I would go about doing it.

    Thanks very much,

  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 02 Mar 2012 Link to this post

    Hi Martyn,

    First of all I should say that using the ItemTooltipOpening in code-behind doesn't breaks the concept of MVVM.  However this is my opinion - it's up to you to embrace it or not.

    The example attached below demonstrates how you may show customized tooltips with the use of RadTooltipService and without any code-behind. Here's a short explanation of the approach - you should retemplate your series definition and add your own DataTemplate that will be used to visualize the tooltip. The content of the tooltip comes from the propeties of the DataItem.

    Let me know how this works for you.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top