or
Hi,
I have a Pie Chart and the following code:
DataSeries series =
new
DataSeries();
series.Definition =
new
PieSeriesDefinition();
series.Definition.InteractivitySettings.SelectionMode = ChartSelectionMode.Single;
series.Definition.InteractivitySettings.SelectionScope = InteractivityScope.Item;
series.Add(
new
DataPoint(1));
series.Add(
new
DataPoint(2));
series.Add(
new
DataPoint(3));
series.Add(
new
DataPoint(4));
radChart.DefaultView.ChartArea.DataSeries.Add(series);
radChart.DefaultView.ChartArea.SelectItem(0);
What I would like to do is to “pre-select” an item immediately after generating the chart. However, the SelectItem in my code doesn’t work because it seems the SelectItem needs the chart to first be rendered. If I call the SelectItem from a timer (and then the chart has been rendered), then it works. Is there a way to call the SelectItem when the chart hasn’t been rendered? Or is there a way to know when the chart and the different elements have been generated so that the SelectItem will work?
Thanks!
public
class
ReceptionRowStyleSelector : StyleSelector<br>
{
public
override
Style SelectStyle(
object
item, DependencyObject container)
{
if
(item
is
Reception)
{
var reception = (Reception)item;
if
(reception.IsCompleted)
return
CompletedReception;
if
(reception.IsCanceledByClient)
return
CanceledReception;
if
(reception.IsClientNotified)
return
NotifiedReception;
}
return
DefaultStyle;
}
...
<
DataTemplate
x:Key
=
"CustomToolTipDataTemplate2"
x:Name
=
"toolTipTemplate2"
>
<
StackPanel
Margin
=
"10,5"
>
<
TextBlock
FontWeight
=
"Bold"
FontFamily
=
"Trebuchet MS"
FontSize
=
"12"
Text
=
"{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='NAME', StringFormat=County: {0}}"
/>
<
TextBlock
x:Name
=
"KPITip"
FontFamily
=
"Trebuchet MS"
FontSize
=
"12"
Text
=
"{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='PAT_EST', StringFormat='Percentage of Paternity Established: {0:0.##}'}"
/>
</
StackPanel
>
</
DataTemplate
>
</
Grid.Resources
>