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

RodPivotMap doesn't show custom tooltip

1 Answer 65 Views
TreeMap and PivotMap
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 24 Aug 2012, 09:33 AM

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 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 29 Aug 2012, 08:21 AM
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.

Tags
TreeMap and PivotMap
Asked by
Alex
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or