【问题标题】:Multiple charts Styling - individual Color多个图表样式 - 单独颜色
【发布时间】:2013-06-03 07:14:34
【问题描述】:

我有这个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>  

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

【问题讨论】:

    标签: c# wpf wpftoolkit silverlight-toolkit


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-15
      相关资源
      最近更新 更多