0

我有这个BubbleChart,我想添加一个人Style来显示一个ToolTip. 当我这样做时,ToolTip一切都很好,直到我添加了第二个系列 - 现在以前的颜色设置(每个系列都有不同的颜色)已经消失了,每个系列都有相同的颜色。有人知道要绑定系列的默认颜色吗?

我试过了Template Binding,但它不会工作。

<Style x:Key="BubbleToolTipTemplate" TargetType="{x:Type c:BubbleDataPoint}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="c:BubbleDataPoint">
                <Grid RenderTransformOrigin=".5,.5">
                    <Grid.RenderTransform>
                        <ScaleTransform ScaleX=".75" ScaleY=".75" />
                    </Grid.RenderTransform>

                    <!-- This Ellipse should bind on the default color -->
                    <Ellipse  Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" />
                    <ContentPresenter Content="{TemplateBinding Size}" HorizontalAlignment="Center" VerticalAlignment="Center" />

                    <ToolTipService.ToolTip>
                        <StackPanel>
                            <ContentControl Content ="{ TemplateBinding DependentValue, Converter={StaticResource DoubleToStringConverter}}" />
                            <ContentControl Content ="{ TemplateBinding IndependentValue}"/>
                            <ContentControl Content ="{ TemplateBinding Size }" />
                        </StackPanel>
                     </ToolTipService.ToolTip>
                 </Grid>
             </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>  

也许以前有人处理过这个!任何帮助表示赞赏!

4

1 回答 1

0

好的,我找到了解决方案!

在后台有 generic.xaml,您可以在其中找到 Bubbledatapoint 的默认样式(您可以在此处找到)。

当我通读这篇文章时,如果找到了 Palette 资源。后来我尝试绑定这些颜色,直到找到诀窍!

只需将椭圆的填充属性设置为 {DynamicResource Background}" !

于 2013-06-07T12:49:30.043 回答