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 1077739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:37:13+00:00 2026-05-16T21:37:13+00:00

Any ideas regarding why the WPF XAML code I have is not working. I’m

  • 0

Any ideas regarding why the WPF XAML code I have is not working. I’m trying to override the WPFToolkit charting display, and have taken their default XAML and included in my Grid.Resources section as a means of overriding. Specifically I’m wanting to remove the graph markers, but this specific question pertains to clarifying my understanding of XAML by asking why these specific approaches do not work:

a) – I’ve tried putting Visibility=”Hidden in the Grid element but this doesn’t seem to work? Why would this be?

b) tried taking out all the lines in the tag, however this doesn’t work. Why would this be? Should this not override things. I’m wondering if my whole override template here is really working at all for LineDataPoint? (I do note that the LineSeries override I have in the below code however do work)

XAML is:

        <!--  charting:LineSeries  -->
        <Style TargetType="chartingToolkit:LineSeries">
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="PolylineStyle">
                <Setter.Value>
                    <Style TargetType="Polyline">
                        <Setter Property="StrokeThickness" Value="1" />
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>

        <!--  charting:LineDataPoint  -->
        <Style TargetType="chartingToolkit:LineDataPoint">
            <Setter Property="Background" Value="Orange" />
            <Setter Property="BorderBrush" Value="Red" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="Width" Value="2" />
            <Setter Property="Height" Value="2" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                        <Grid x:Name="Root" Opacity="0" Visibility="Hidden">
                            <Ellipse Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Height="30"/>
                            <Ellipse RenderTransformOrigin="0.661,0.321">
                                <Ellipse.Fill>
                                    <RadialGradientBrush GradientOrigin="0.681,0.308">
                                        <GradientStop Color="Green" />
                                        <GradientStop Color="#FFFFFFFF" Offset="1" />
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="SelectionHighlight" Opacity="0" Fill="Red" />
                            <Ellipse x:Name="MouseOverHighlight" Opacity="0" Fill="White" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Grid.Resources>

    <chartingToolkit:Chart Title="Engine Performance">
        <!-- Power curve -->
        <chartingToolkit:LineSeries
                        Title="Power"
                        ItemsSource="{StaticResource EngineMeasurementCollection}"
                        IndependentValueBinding="{Binding Speed}"
                        DependentValueBinding="{Binding Power}">
            <!-- Vertical axis for power curve -->
            <chartingToolkit:LineSeries.DependentRangeAxis>
                <chartingToolkit:LinearAxis
                                Orientation="Y"
                                Title="Power (hp)"
                                Minimum="0"
                                Maximum="250"
                                Interval="50"
                                ShowGridLines="True"/>
            </chartingToolkit:LineSeries.DependentRangeAxis>
        </chartingToolkit:LineSeries>
        <!-- Torque curve -->
        <chartingToolkit:LineSeries
                        Title="Torque"
                        ItemsSource="{StaticResource EngineMeasurementCollection}"
                        IndependentValueBinding="{Binding Speed}"
                        DependentValueBinding="{Binding Torque}">
            <!-- Vertical axis for torque curve -->
            <chartingToolkit:LineSeries.DependentRangeAxis>
                <chartingToolkit:LinearAxis
                                Orientation="Y"
                                Title="Torque (lb-ft)"
                                Minimum="50"
                                Maximum="300"
                                Interval="50"/>
            </chartingToolkit:LineSeries.DependentRangeAxis>
        </chartingToolkit:LineSeries>
        <chartingToolkit:Chart.Axes>
            <!-- Shared horizontal axis -->
            <chartingToolkit:LinearAxis
                            Orientation="X"
                            Title="Speed (rpm)"
                            Interval="1000"
                            ShowGridLines="True"/>
        </chartingToolkit:Chart.Axes>
    </chartingToolkit:Chart>
</Grid>

EDIT:

PS. I’ve boiled it down to the fact the template isn’t picked up it seem in the code below – but it should be picked up no? i.e. I have NOT set an x:key against

<Window x:Class="MyInternetUsage.EnginePerformance"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:local="clr-namespace:DataVisualizationDemos" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" Title="EnginePerformance" Height="277" Width="371">
    <Grid>
        <Grid.Resources>
            <local:EngineMeasurementCollection x:Key="EngineMeasurementCollection"/>

            <!--  charting:LineDataPoint  -->
            <Style TargetType="chartingToolkit:LineDataPoint">
                <Setter Property="Background" Value="Orange" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="chartingToolkit:LineDataPoint">

                            <Grid
                                Width="30"
                                Height="30"
                                Background="{TemplateBinding Background}"/>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>

        <chartingToolkit:Chart Title="Engine Performance">
            <!-- Power curve -->
            <chartingToolkit:LineSeries
                            Title="Power"
                            ItemsSource="{StaticResource EngineMeasurementCollection}"
                            IndependentValueBinding="{Binding Speed}"
                            DependentValueBinding="{Binding Power}">

            </chartingToolkit:LineSeries>

        </chartingToolkit:Chart>
    </Grid>
</Window>

thanks

  • 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-16T21:37:13+00:00Added an answer on May 16, 2026 at 9:37 pm

    It is possible that the LineDataPoint is not templatable or at least not fully, by virtue of having many of its style properties defined internally.

    You can set a default style as you’ve done, and this works very well for the “lookless” controls that are part of the framework, because they are designed with templating in mind (and so make use of TemplateBindings), but if a control, for example, declares internally that its background is purple, you cannot override this with a style.

    It is also possible that what you’re seeing is not actually the background of the control itself, rather the background of a constituent control within. If the component designed does not “pass through” the property, setting values on the control itself won’t affect the internal parts that you see.

    Finally, it is possible that Chart defines a default style for LineDataPoint. Being in a narrower scope than your grid resource, this would take precedence.

    If you have access to the source, you can suss this out; without the source or good documentation of the component, it is just a frustrating trial-and-error guessing game as to what is going on.

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

Sidebar

Related Questions

Does anyone have any ideas or references they could point me to regarding optimizing
Any ideas given the code below why the highlight is being triggered to run
I have a WPF project and I'm trying to setup a NAnt build script
Just wondering if anyone has got any ideas regarding sneak-peaking the content of a
Any ideas what I am doing wrong??? INSERT INTO LondonFixes ('id', 'Metal', 'AmPm', 'GBP',
Any ideas how I can create a join on a table retrieved from data
Any ideas about escape analysis in dalvik? Or when and if it's planned to
Any ideas how I would go about writing a javascript method to insert an
Any ideas how to fix this? UserService.UserServiceClient userServiceClient = new UserServiceClient(); userServiceClient.GetUsersCompleted += new
Any ideas of how best i can implement article revision history for a Java

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.