RodPivotMap doesn't show custom tooltip

2 posts, 0 answers
  1. Alex
    Alex avatar
    3 posts
    Member since:
    Aug 2012

    Posted 24 Aug 2012 Link to this post

    Hi,

    I have a simple RadPivotMap, latest build, defined like this:

    <telerik:RadPivotMap x:Name="RadTreeMap" LayoutStrategy="Squarified"
         ItemsSource="{Binding CountryData}"
         LabelPath="Country" ValuePath="CountryAmount"
         ToolTipPath="CountryAmount" ToolTipFormat="{}{0:N0} i/day}">
     <telerik:RadPivotMap.GroupDefinitions>
      <telerik:GroupDefinition Member="Continent">
      </telerik:GroupDefinition>
     </telerik:RadPivotMap.GroupDefinitions>
     
    </telerik:RadPivotMap>

     

    Data from ViewModel is simple too:

    public IEnumerable<CountryItem> CountryData // ... regular MVVM property
    public class CountryItem
    {
     [Key]
     public int ID { get; set; }
     public string Continent { get; set; }
     public string Country { get; set; }
     public string CountryAmount { get; set; }
    }

     
    Using MS DomainContext/DomainDataSource to load data from DB:

    _domainDataSource.LoadedData += (_o, _e) =>
     {
       List<CountryItem> list = new List<CountryItem>();
     
       foreach (vwCountry v in _e.Entities)
       {
        list.Add(new CountryItem()
        {
         ID = v.ID,
         Region = v.Region,
         Country = v.Country,
           CountryAmount = v.Amount,
        });
       }
     
       this.CountryData = list.AsEnumerable();
      }
     };

      

    Now I want to get ToolTip on RadPivotMap's items. If I do it like in Telerik samples

     

    <controls:ChildWindow.Resources>
        <DataTemplate x:Key="tooltTipTemplate">
        ...
        </DataTemplate>
    </controls:ChildWindow.Resources>

    then I get 2 exceptions for each CountryData item:
     System.Windows.Data Error: Cannot get 'ToolTip' value (type 'System.Object') from 'TreeMapData Value: 145170; ChildrenCount: 0; Depth: 1' (type 'Telerik.Windows.Controls.TreeMap.GroupData'). BindingExpression: Path='ToolTip' DataItem='TreeMapData Value: 145170; ChildrenCount: 0; Depth: 1' (HashCode=27707615); target element is 'Telerik.Windows.Controls.TreeMap.RadTreeMapItem' (Name=''); target property is 'ToolTipContent' (type 'System.Object').. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format.
     System.Windows.Data Error: Cannot get 'ToolTipAvailable' value (type 'System.Boolean') from 'TreeMapData Value: 145170; ChildrenCount: 0; Depth: 1' (type 'Telerik.Windows.Controls.TreeMap.GroupData'). BindingExpression: Path='ToolTipAvailable' DataItem='TreeMapData Value: 145170; ChildrenCount: 0; Depth: 1' (HashCode=27707615); target element is 'Telerik.Windows.Controls.TreeMap.RadTreeMapItem' (Name=''); target property is 'IsEnabled' (type 'System.Boolean').. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format.

     
    And if I try to set template inside RadPivotMap -

    <telerik:RadPivotMap.ToolTipTemplate>
        <DataTemplate>
            ...
        </DataTemplate>
    </telerik:RadPivotMap.ToolTipTemplate>

     

    I get nothing at all - no exceptions, no tooltip
         
    What am I doing wrong?

    TIA 

  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 29 Aug 2012 Link to this post

    Hi Alex,

    This example shows tooltips on pivotmap in action. The template is defined in the resources and is then set to the pivotmap using a StaticResource markup extension. Please note, that currently only leaves have tooltips.

    All the best,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top