Hi
We are using the following style, supplied by ChartFX, to make the Legend box collapsable:
<Style TargetType="{x:Type ItemsControl}" x:Key="LegendBoxStyle">
<Style.Setters>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<Expander x:Name="expLegend" Header="Legend Box" Foreground="White">
<ScrollViewer HorizontalScrollBarVisibility="Auto" MaxWidth="300" Margin="0,5,0,0">
<ItemsPresenter />
</ScrollViewer>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
Can you advise how we might catch events thrown by the "expExpander" control?
I had tried Inheriting the ChartFX Chart object and overriding the OnTemplateApplied method but without result:
public
class CustomCFXChart : Chart
{
public CustomCFXChart ()
{
}
public bool LegendExpanded { get; set; }public override void OnApplyTemplate()
{
DependencyObject d = GetTemplateChild("expLegend");if (d != null)
{
(d as Expander).Expanded += new RoutedEventHandler(expLegend_Expanded);(d as Expander).Collapsed += new RoutedEventHandler(expLegend_Collapsed);
}
base.OnApplyTemplate();
}
void expLegend_Expanded(object sender, RoutedEventArgs e)
{
LegendExpanded = true;
}
void expLegend_Collapsed(object sender, RoutedEventArgs e)
{
LegendExpanded = false;
}
}
Many thanks
Paul Eden