Domanda

I've got this BubbleChart where I wanted to add an individual Style to show a ToolTip. As I did this, the ToolTip was there and everything was fine until I added a second Series - now the former color setup (each series a different color) was gone and each Series had the same color. Does someone knowshow to bind on the default color of the series?

I tried a Template Binding but it won't work.

<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>  

Maybe someone handled this before! Any help is appreciated!

È stato utile?

Soluzione

Ok I've found a solution!

In the Background there is the generic.xaml where you can find the default Style of the Bubbledatapoint (You can find this here ).

As i read through this if found the Palette resource. Later i tried to bind on those colours until i found the trick!

Just set the fill property of the ellipse to {DynamicResource Background}" !

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top