I want to add a button above all column in Charts in the Silverlight Toolkit.
Same with this Picture:
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.
You can add anything you need to the ControlTemplate
.
In your case this would mean you have to add a Panel
(eg 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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.