I have an extended ObservableCollection
that holds the datapoints plus some extra information
public class ExtendedCollection : ObservableCollection<KeyValuePair<string, KeyValuePair<string,int>>>
{
}
Then I also have a ViewModel holding the ColumnSeries
that uses this ExtendedCollection
private ExtendedCollection columnValues = new ExtendedCollection();
public ExtendedCollection ColumnValues
{
get
{
return columnValues;
}
set
{
columnValues = value;
PropChanged("ColumnValues");
}
}
Finally, I am trying to display the collection items' Value.Key
on a label templated in each datapoint's column
<chartingToolkit:ColumnSeries Name="columnSeries" DependentValuePath="Value.Value" IndependentValuePath="Key" ItemsSource="{Binding ColumnValues}">
<chartingToolkit:ColumnSeries.DataPointStyle>
<Style TargetType="chartingToolkit:ColumnDataPoint">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chartingToolkit:ColumnDataPoint">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type chartingToolkit:ColumnSeries}},Path=DataContext.ColumnValues.Value.Key, Mode=TwoWay}"></Label>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</chartingToolkit:ColumnSeries.DataPointStyle>
</chartingToolkit:ColumnSeries>
I've tried many different Binding
s for the Label
's Content
but none works. How can I link the Content
to the Value.Key
of ColumnDataPoint
The ExtendedCollection
property has no Value
property but the DataContext
of the column has:
<Label Grid.Row="0" Content="{Binding Value.Key}"></Label>