Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:50:17+00:00 2026-05-24T02:50:17+00:00

I am trying to customized my tooltip – PieDataPoint, however, palette’s are not working

  • 0

I am trying to customized my tooltip – PieDataPoint, however, palette’s are not working anymore. Is there anything that I’ve missed out?

It seems that when I add the below to PieDataPoint, the chart becomes red.

<Setter Property="Background" Value="Red"/>

Thanks!

<charting:PieSeries
        ItemsSource="{Binding}"
        DependentValueBinding="{Binding Length}"
        IndependentValueBinding="{Binding}">
            <charting:PieSeries.DataPointStyle>
                <Style TargetType="charting:PieDataPoint">
                    <Setter Property="BorderThickness" Value="1"/>
                    <Setter Property="IsTabStop" Value="False"/>
                    <Setter Property="RatioStringFormat" Value="{}{0:p2}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="charting:PieDataPoint">
                                <Grid
                    x:Name="Root"
                    Opacity="0">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.1"/>
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Normal"/>
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation
                                        Storyboard.TargetName="MouseOverHighlight"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0.6"
                                        Duration="0"/>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="SelectionStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.1"/>
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Unselected"/>
                                            <VisualState x:Name="Selected">
                                                <Storyboard>
                                                    <DoubleAnimation
                                        Storyboard.TargetName="SelectionHighlight"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0.6"
                                        Duration="0"/>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="RevealStates">
                                            <VisualStateGroup.Transitions>
                                                <VisualTransition GeneratedDuration="0:0:0.5"/>
                                            </VisualStateGroup.Transitions>
                                            <VisualState x:Name="Shown">
                                                <Storyboard>
                                                    <DoubleAnimation
                                        Storyboard.TargetName="Root"
                                        Storyboard.TargetProperty="Opacity"
                                        To="1"
                                        Duration="0"/>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Hidden">
                                                <Storyboard>
                                                    <DoubleAnimation
                                        Storyboard.TargetName="Root"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0"
                                        Duration="0"/>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Path
                        x:Name="Slice"
                        Data="{TemplateBinding Geometry}"
                        Fill="{TemplateBinding Background}"
                        Stroke="{TemplateBinding BorderBrush}"
                        StrokeMiterLimit="1">
                                        <ToolTipService.ToolTip>
                                            <StackPanel>
                                                <ContentControl Content="Test"/>
                                                <ContentControl Content="{TemplateBinding FormattedDependentValue}"/>
                                                <ContentControl Content="{TemplateBinding FormattedRatio}"/>
                                            </StackPanel>
                                        </ToolTipService.ToolTip>
                                    </Path>
                                    <Path
                        x:Name="SelectionHighlight"
                        Data="{TemplateBinding GeometrySelection}"
                        Fill="Red"
                        StrokeMiterLimit="1"
                        IsHitTestVisible="False"
                        Opacity="0"/>
                                    <Path
                        x:Name="MouseOverHighlight"
                        Data="{TemplateBinding GeometryHighlight}"
                        Fill="White"
                        StrokeMiterLimit="1"
                        IsHitTestVisible="False"
                        Opacity="0"/>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </charting:PieSeries.DataPointStyle>
            <charting:PieSeries.Palette>
                <datavis:ResourceDictionaryCollection>

                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#FFB8C0AC"/>
                            <GradientStop Color="#FF5F7143" Offset="1"/>
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}"/>
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>

                    <ResourceDictionary>
                        <RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
                            <GradientStop Color="#FFFDE79C"/>
                            <GradientStop Color="#FFF6BC0C" Offset="1"/>
                        </RadialGradientBrush>
                        <Style x:Key="DataPointStyle" TargetType="Control">
                            <Setter Property="Background" Value="{StaticResource Background}"/>
                        </Style>
                        <Style x:Key="DataShapeStyle" TargetType="Shape">
                            <Setter Property="Stroke" Value="{StaticResource Background}" />
                            <Setter Property="StrokeThickness" Value="2" />
                            <Setter Property="StrokeMiterLimit" Value="1" />
                            <Setter Property="Fill" Value="{StaticResource Background}" />
                        </Style>
                    </ResourceDictionary>
                </datavis:ResourceDictionaryCollection>
            </charting:PieSeries.Palette>
        </charting:PieSeries>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:50:18+00:00Added an answer on May 24, 2026 at 2:50 am

    Fortunately, I solved this by putting some code in codebehind. However, my another question now is how to apply this one in MVVM?

    In my XAML here’s my chart:

    <charting:Chart  x:Name="tempChart"
            Title="Simple Palette Change"
            Grid.Column="0"
            Grid.Row="1">
            <charting:PieSeries
                ItemsSource="{Binding}"
                DependentValueBinding="{Binding Length}"
                IndependentValueBinding="{Binding}">
            </charting:PieSeries>
        </charting:Chart>
    

    In my XAML resources here’s my datapoint template:

    <ControlTemplate x:Key="pi" TargetType="charting:PieDataPoint">
            <Grid x:Name="Root" Opacity="0">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0:0:0.1"/>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="MouseOver">
                            <Storyboard>
                                <DoubleAnimation
                                            Storyboard.TargetName="MouseOverHighlight"
                                            Storyboard.TargetProperty="Opacity"
                                            To="0.6"
                                            Duration="0"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="SelectionStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0:0:0.1"/>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Unselected"/>
                        <VisualState x:Name="Selected">
                            <Storyboard>
                                <DoubleAnimation
                                            Storyboard.TargetName="SelectionHighlight"
                                            Storyboard.TargetProperty="Opacity"
                                            To="0.6"
                                            Duration="0"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="RevealStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0:0:0.5"/>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Shown">
                            <Storyboard>
                                <DoubleAnimation
                                            Storyboard.TargetName="Root"
                                            Storyboard.TargetProperty="Opacity"
                                            To="1"
                                            Duration="0"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Hidden">
                            <Storyboard>
                                <DoubleAnimation
                                            Storyboard.TargetName="Root"
                                            Storyboard.TargetProperty="Opacity"
                                            To="0"
                                            Duration="0"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Path x:Name="Slice"
                    Data="{TemplateBinding Geometry}"
                    Fill="{TemplateBinding Background}"
                    Stroke="{TemplateBinding BorderBrush}"
                    StrokeMiterLimit="1">
                    <ToolTipService.ToolTip>
                        <StackPanel>
                            <ContentControl>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{TemplateBinding IndependentValue}" />
                                    <TextBlock Text=" - "/>
                                    <TextBlock Text="{TemplateBinding FormattedDependentValue}"/>
                                </StackPanel>
                            </ContentControl>
                            <ContentControl Content="{TemplateBinding FormattedRatio}"/>
                        </StackPanel>
                    </ToolTipService.ToolTip>
                </Path>
                <Path x:Name="SelectionHighlight"
                    Data="{TemplateBinding GeometrySelection}"
                    Fill="Red"
                    StrokeMiterLimit="1"
                    IsHitTestVisible="False"
                    Opacity="0"/>
                <Path x:Name="MouseOverHighlight"
                    Data="{TemplateBinding GeometryHighlight}"
                    Fill="White"
                    StrokeMiterLimit="1"
                    IsHitTestVisible="False"
                    Opacity="0"/>
            </Grid>
        </ControlTemplate>
    

    In my code behind:

    ResourceDictionaryCollection palette = new ResourceDictionaryCollection();
            Random rom = new Random();
            for (int i = 0; i < 256; i++)
            {
                byte r = Convert.ToByte(rom.Next(256));
                byte g = Convert.ToByte(rom.Next(256));
                byte b = Convert.ToByte(rom.Next(256));
                Style style = new Style(typeof(Control));
                style.Setters.Add(new Setter(BackgroundProperty, new SolidColorBrush(Color.FromArgb(255, r, g, b))));
                style.Setters.Add(new Setter(TemplateProperty, this.Resources["pi"]));
                ResourceDictionary dictionary = new ResourceDictionary();
                dictionary.Add("DataPointStyle", style);
                palette.Add(dictionary);
            }
    
            tempChart.Palette = palette;
    

    Here’s the output of my custom PieDataPoint with Palette:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a customized UISearchBar. I am not able to find
I'm trying to make a customized view that gets me the row count for
I am trying to create a customized messagebox using javascript but not getting too
I'm trying to subclass wx.Process such that I have a customized process launcher that
I am trying to have my interface dynamically generate a customized button when I
I am trying to customize Django's comments form. Inside django.contrib.comments.forms I noticed that all
I'm trying to apply a DASL Filter [customized View] on a search Folder with
I'm trying to give the user ability to create customized list for my application,by
I've been trying to import shape xml to customized View. like this, <shape xmlns:android=http://schemas.android.com/apk/res/android
I am trying to put Name and phone numbers from contacts to my customized

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.