Greetings,
First, I am really glad Telerik has added a TreeMap to an already stellar lineup of Silverlight controls.
That said, I'm having an issue with DataBinding a TreeMap using an MVVP type model. The issue is that I can set data for the TreeMap from the Constuctor of the ViewModel and everything works fine. However, the control is not updated when setting data from an Async callback (returning data from a web service). Not even if I crawl the VisualTree, get the object and forcibly set the ItemsSource.
I thought I had everything set up properly but since it isn't working...
View:
ViewModel:
First, I am really glad Telerik has added a TreeMap to an already stellar lineup of Silverlight controls.
That said, I'm having an issue with DataBinding a TreeMap using an MVVP type model. The issue is that I can set data for the TreeMap from the Constuctor of the ViewModel and everything works fine. However, the control is not updated when setting data from an Async callback (returning data from a web service). Not even if I crawl the VisualTree, get the object and forcibly set the ItemsSource.
I thought I had everything set up properly but since it isn't working...
View:
<
telerik:RadTreeMap
x:Name
=
"HeatMap"
ItemsSource
=
"{Binding Milestones}"
LayoutStrategy
=
"Squarified"
>
<
telerik:RadTreeMap.TypeDefinitions
>
<
telerik:TypeDefinition
TargetTypeName
=
"Milestone"
ValuePath
=
"Complete"
LabelPath
=
"Name"
ToolTipPath
=
"Complete"
ToolTipFormat
=
"{}{0:P0}"
>
<
telerik:TypeDefinition.Mappings
>
<
telerik:RelativeValueGradientColorizer
RangeMinimum
=
"0"
RangeMaximum
=
"100"
>
<
GradientStop
Color
=
"Red"
Offset
=
"0"
/>
<
GradientStop
Color
=
"Green"
Offset
=
"1"
/>
<
GradientStop
Color
=
"Yellow"
Offset
=
"0.5"
/>
</
telerik:RelativeValueGradientColorizer
>
</
telerik:TypeDefinition.Mappings
>
</
telerik:TypeDefinition
>
</
telerik:RadTreeMap.TypeDefinitions
>
</
telerik:RadTreeMap
>
ViewModel:
private List<
Milestone
> _Milestones;
public List<
Milestone
> Milestones
{
get
{
return this._Milestones;
}
set
{
if (this._Milestones != value)
{
this._Milestones = value;
this.OnPropertyChanged("Milestones");
}
}
}
//Constructor
public FacilityViewModel()
{
Milestones = new List<
Milestone
>();
//Works from the Constructor
Milestones.Add(new Milestone() { Name = "Mile1", Complete = 10 });
Milestones.Add(new Milestone() { Name = "Mile2", Complete = 20 });
Milestones.Add(new Milestone() { Name = "Mile3", Complete = 30 });
Milestones.Add(new Milestone() { Name = "Mile4", Complete = 40 });
Milestones.Add(new Milestone() { Name = "Mile5", Complete = 50 });
}
//Async Callback
void GetMilestonePercentComplete(object sender, DataService.GetMilestonePercentCompleteEventArgs e)
{
//Does not work in the callback
Milestones.Add(new Milestone() { Name = "Mile6", Complete = 60 });
Milestones.Add(new Milestone() { Name = "Mile7", Complete = 70 });
Milestones.Add(new Milestone() { Name = "Mile8", Complete = 80 });
Milestones.Add(new Milestone() { Name = "Mile9", Complete = 90 });
Milestones.Add(new Milestone() { Name = "Mile10", Complete = 100 });
}