0
votes

I want to add a button above all column in Charts in the Silverlight Toolkit.

Same with this Picture:

enter image description here

I add style for DataPointStyle:

<Style x:Key="ColorByGradeColumn" TargetType="toolkit:ColumnDataPoint">
    <Setter Property="Background" Value="DarkGray"/>
    <Setter Property="Template">
        <Setter.Value>

             <ControlTemplate TargetType="toolkit:ColumnDataPoint">
                  <Border
                      MouseEnter="Border_MouseEnter"
                      MouseLeave="Border_MouseLeave"
                      Background="{Binding Legend.Color,
                          Converter={StaticResource stringToSolidColorBrushConverter}}"
                      BorderThickness="0.5"
                      Tag="{Binding Legend}"
                      MouseLeftButtonUp="Col_MouseLeftButtonUp">

                  </Border>   
            </ControlTemplate>
       </Setter.Value>
   </Setter>
</Style>

but i don't know where i should add button.

1

1 Answers

1
votes

You can add anything you need to the ControlTemplate.

In your case this would mean you have to add a Panel (e.g. a Grid) to arrange the button and the bar:

<ControlTemplate TargetType="toolkit:ColumnDataPoint">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button Grid.Row="0" ... />
        <Border Grid.Row="1" ... />
    </Grid>
</ControlTemplate>