0

I've just compiled an old project that uses Presentation Framework's DataVisualization and I'm getting a "Not Suported Exception":

Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'.

at

System.Windows.Markup.DependencyPropertyConverter.ResolveProperty(IServiceProvider serviceProvider, String targetName, Object source)"

Great, easy to solve, just don't set a non dependency property in a setter right?

Except it's occurring on the code-behind line:

var la = new LinearAxis();

and the exception in the presentation framework itself, which I have no control over. Has anyone encountered this? How can I solve an error in an external library like this? I can't imagine it's a bug in the constructor, I must be doing something on my end that's causing it.

This is the chart style, I'll try removing it and see if that's affecting things:

<Style TargetType="{x:Type chartingToolkit:Chart}">
    <!--<Setter Property="LegendStyle" Value="{StaticResource LedgendStyle}"/>-->
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type chartingToolkit:Chart}">
                <Border Background="{TemplateBinding Background}" BorderBrush="{x:Null}" BorderThickness="0" Padding="2">
                    <Grid>
                        <Primitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                            <Grid Panel.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" Background="{StaticResource GraphBackground}" />
                            <Border Panel.ZIndex="10" BorderBrush="{StaticResource GraphBorder}" BorderThickness="{StaticResource GrephBorderThickness}" />
                        </Primitives:EdgePanel>
                        <visualizationToolkit:Legend 
                                    x:Name="Legend"
                                    Style="{TemplateBinding LegendStyle}"
                                    Grid.Column="1"
                                    Margin="50,10"
                                    VerticalAlignment="Top"
                                    HorizontalAlignment="Left"
                                    Background="{StaticResource LegendBackground}"/>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

One thing I've noticed, if I run without debug everything seems fine...

Community
  • 1
  • 1
Joe
  • 6,773
  • 2
  • 47
  • 81
  • 1
    What library are you using? Charting Toolkit? Telerik? – Il Vic Sep 05 '16 at 10:40
  • Sorry thought it was "PresentationFramework", the standard .NET DataVisualization System.Windows.Controls.DataVisualization.Charting – Joe Sep 05 '16 at 11:22
  • 1
    Did you declare a style for the LinearAxis object? Considering just that line of code (i.e. `var la = new LinearAxis();`) your issue seems to be not reproducible – Il Vic Sep 08 '16 at 08:01
  • It's awfully unreproducible. Sorry! There's no style for LinearAxis defined in the project. I'll see if I can find the default one and manually add it. There is a style for the chart itself. – Joe Sep 08 '16 at 08:46
  • Trying to reproduce the bug now, and it's stopped happening altogether :| – Joe Sep 08 '16 at 08:52
  • So now it is solved ;-) Well done! – Il Vic Sep 08 '16 at 09:46

0 Answers0