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

  • SEARCH
  • Home
  • 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 7732193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:40:12+00:00 2026-06-01T06:40:12+00:00

I have a WPF Chart that I am dynamically binding a BarSeries to. I

  • 0

I have a WPF Chart that I am dynamically binding a BarSeries to. I would like to have the BarSeries show 3 pieces of information, however. The third piece of information I would like to be shown in the tooltip of any given datapoint.

Is there any way to dynamically bind the value/content of the tooltip for a given datapoint in my barseries??

XAML:

<UserControl.Resources>
    <Style
       x:Key="SimpleDataPointStyle"
       BasedOn="{StaticResource {x:Type chartingToolkit:BarDataPoint}}"
       TargetType="{x:Type chartingToolkit:BarDataPoint}">
        <Setter Property="Width" Value="20"/>
        <Setter Property="Height" Value="20"/>
        <Setter x:Name="DataPointToolTip" Property="ToolTip" Value="{Binding Path=Event_Description}"/>
    </Style>
</UserControl.Resources>
<Grid x:Name="MetricsPanel" Width="904" Height="376" HorizontalAlignment="Left" VerticalAlignment="Top">   
    <chartingToolkit:Chart x:Name="MetricChart" HorizontalAlignment="Left" Width="464" Height="352" VerticalAlignment="Top">
        <chartingToolkit:Chart.Series>
            <chartingToolkit:BarSeries x:Name="MainSeries"
                                       Title="Contribution to Risk and Errors (%)"
                                       IndependentValueBinding="{Binding}"
                                       DependentValueBinding="{Binding}">
                <chartingToolkit:BarSeries.DataPointStyle>
                    <Style
                        BasedOn="{StaticResource SimpleDataPointStyle}"
                        TargetType="{x:Type chartingToolkit:BarDataPoint}">  
                    </Style>
                </chartingToolkit:BarSeries.DataPointStyle>

            </chartingToolkit:BarSeries>
        </chartingToolkit:Chart.Series>
    </chartingToolkit:Chart>

Code-Behind

highestWeightedEvents = BuildHighestWeightedEventsTable();

        MainSeries.DependentValueBinding = new Binding("Cutset_Frequency");
        MainSeries.IndependentValueBinding = new Binding("Event_Number");
        MainSeries.ItemsSource = highestWeightedEvents.DefaultView;
        Style dataPointStyle = (Style)Resources["SimpleDataPointStyle"];
        MainSeries.DataPointStyle = dataPointStyle;

How can I specify the binding for the tooltip in code behind?

Thank in advance…

  • 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-06-01T06:40:14+00:00Added an answer on June 1, 2026 at 6:40 am

    I actually solved my own problem last night by completely redefining the template for BarDataPoint.

    Style XAML:

    <Style x:Key="NewDataPointStyle" TargetType="chartingToolkit:BarDataPoint">
    <Setter Property="Background" Value="SteelBlue" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="BorderBrush" Value="#FF686868" />
    <Setter Property="Width" Value="20" />
    <Setter Property="Height" Value="20" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="chartingToolkit:BarDataPoint">
                <Grid x:Name="Root" Opacity="1">
                    <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>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.3" />
                                    </DoubleAnimationUsingKeyFrames>
                                </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>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectionHighlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.185" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectionHighlight" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                        <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF8A8A8A" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="RevealStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="0:0:0.5" />
                            </VisualStateGroup.Transitions>
                            <VisualState x:Name="Shown">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Root" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Hidden">
                                <Storyboard>
                                    <DoubleAnimation Duration="0" Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0" />
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ToolTipService.ToolTip>
                        <ContentControl Content="{Binding Path=Event_Description}" />
                    </ToolTipService.ToolTip>
                            <StackPanel Orientation="Horizontal"
                                    Background="{TemplateBinding Background}">
                            </StackPanel>
                    </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    

    Chart XAML:

    <chartingToolkit:Chart x:Name="MetricChart" HorizontalAlignment="Left" Width="464" Height="352" VerticalAlignment="Top">
            <chartingToolkit:Chart.Axes>
                <chartingToolkit:LinearAxis Interval="10" Maximum="100" x:Name="XAxis" Orientation="X" Title="Percent Contribution (%)"/>
                <chartingToolkit:CategoryAxis Title="Event Number" Orientation="Y"/>
            </chartingToolkit:Chart.Axes>
            <chartingToolkit:Chart.Series>
                <chartingToolkit:BarSeries x:Name="MainSeries"
                                           Title="Contribution to Risk and Errors (%)"
                                           IndependentValueBinding="{Binding}"
                                           DependentValueBinding="{Binding}" BorderThickness="0" BorderBrush="Black" Background="Black" OpacityMask="Black">
                    <chartingToolkit:BarSeries.DataPointStyle>
                        <Style
                            BasedOn="{StaticResource NewDataPointStyle}"
                            TargetType="{x:Type chartingToolkit:BarDataPoint}">
                        </Style>
                    </chartingToolkit:BarSeries.DataPointStyle>
                </chartingToolkit:BarSeries>
            </chartingToolkit:Chart.Series>
            <chartingToolkit:Chart.LegendStyle>
                <Style TargetType="Control">
                    <Setter Property="Width" Value="0"/>
                    <Setter Property="Height" Value="0"/>
                </Style>
            </chartingToolkit:Chart.LegendStyle>
        </chartingToolkit:Chart>
    

    Code-Behind:

            //highestWeightedEvents is a DataTable
            highestWeightedEvents = BuildHighestWeightedEventsTable();
            MainSeries.DependentValueBinding = new Binding("Cutset_Frequency");
            MainSeries.IndependentValueBinding = new Binding("Event_Number");
            MainSeries.ItemsSource = highestWeightedEvents.DefaultView;
    

    Since I define the DataSeries.ItemsSource in the code-behind, the ToolTip binding knows where to look. I hope somebody else can possibly benefit from this as I spent a whole day figuring this out 😀

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

Sidebar

Related Questions

I have created a WPF chart programmatically and would like to change the Title's
Good day all I have the following question: I would like to use Chart
I have a WPF ListView that is bound to a BindingList<T>. The binding works
I have my own derived WPF DataVisualization chart control and within that control, I
i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
I have a problem with WPF Toolkit Chart Control. I can't add text values
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)
I have WPF Span that is used as a source to a TextBlock. I
I'm writing a WPF calculator app. In this application I have TextBox that get
I have a tree in WPF that has no root node, but has defined

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.