I'm doing a custom PieChart
with the Winrt Xaml Toolkit and I'm having difficulty binding to a property of my main element. Here's the code:
<Charting:Chart x:Name="PieChart" Title="Pie Title" Width="300" Height="300">
<Charting:Chart.Series>
<Charting:PieSeries Title="Population" IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Amount}" IsSelectionEnabled="False" Width="125" Height="125" />
</Charting:Chart.Series>
<Charting:Chart.LegendStyle>
<Style TargetType="datavis:Legend">
<Setter Property="ItemContainerStyle" xmlns:series="using:WinRTXamlToolkit.Controls.DataVisualization.Charting">
<Setter.Value>
<Style TargetType="series:LegendItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="series:LegendItem">
<StackPanel Orientation="Horizontal">
<datavis:Title Content="{TemplateBinding Content}" />
<TextBlock Text="{Binding Amount}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
</Charting:Chart.LegendStyle>
</Charting:Chart>
In my LegendItem
I have a TextBlock
to which I want to bind the DependentValueBinding
property from my Charting:PieSeries
element. How can I do this? I also tried referencing the element Self
but cannot get the sub properties.