07-01-2015 03:52 PM
Hello all,
A data binding error is thrown by the Debug Output window just after setting the DataSource property to some data:
System.Windows.Data Error: 40 :BindingExpression path error: 'Orientation' property not found on 'object' ''ColorScale' (HashCode=50862316)'. BindingExpression:Path=Orientation; DataItem='ColorScale' (HashCode=50862316); target element is 'DependencyPropertyListener' (HashCode=6239444); target property is 'Target' (type 'Object')
I did the following:
Graph graph = new Graph();
graph.Plots.Add(new Plot());
graph.Plots[0].Renderer = new IntensityPlotRenderer();
((IntensityPlotRenderer)graph.Plots[0].Renderer).ColorScale = new ColorScale();
graph.DataSource = new List<System.Windows.Media.Media3D.Point3D>();
The error message is thrown right after executing the assignment of a new List to the DataSource. The error seems harmless but would be nice to understand what is causing this issue.
Thanks.
Solved! Go to Solution.
07-01-2015 04:51 PM
Which version of Measurement Studio and Visual Studio are you using? I can reproduce the problem you're reporting in Measurement Studio 2013 for Visual Studio 2012, but when I run your code snippet in Measurement Studio 2015 for Visual Studio 2013 I do not see the message in the output window.
07-01-2015 04:53 PM
I'm running version Measurement Studio 2013 for Visual Studio 2012 on Visual Studio Professional 2013.
07-07-2015 06:40 PM
I upgraded Measurement Studio to Measurement Studio 2015 and running Visual Studio Professional 2013 and I do not get a binding error with the code snippet above. But I do get the error when I attach the graph to a Border for example:
Snippet
this.Border.Child = graph;
And declare a border:
Snippet
<Grid> <Border Name="Border" /> </Grid>
Please let me know if you get a binding error message when you attach the graph to a Border element. Thank you.
07-08-2015 11:18 AM
I opened the project ColorScale.2013 example in National Instruments\MStudioVS2013\DotNET\Examples\WPF\Standard\ColorScale\cs\ and replaced the code with just the snippets below and the error unfortunately shows up.
In the MainWindow constructor:
Snippet
public MainWindow() { this.InitializeComponent(); Graph graph = new Graph(); graph.Plots.Add(new Plot()); graph.Plots[0].Renderer = new IntensityPlotRenderer(); ((IntensityPlotRenderer)graph.Plots[0].Renderer).ColorScale = new ColorScale(); graph.DataSource = new List<System.Windows.Media.Media3D.Point3D>(); Grid.Children.Add(graph); }
In XAML:
Snippet
<Window x:Class="NationalInstruments.Examples.ColorScale.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Using Color Scale In Intensity Graph" Width="800" Height="600"> <Grid Name="Grid" /> </Window>
The error shows up twice:
System.Windows.Data Error: 40 : BindingExpression path error: 'Orientation' property not found on 'object' ''ColorScale'.
BindingExpression:Path=Orientation;
DataItem='ColorScale';
target element is 'DependencyPropertyListener';
target property is 'Target' (type 'Object')
07-08-2015 06:00 PM
Hi, gabe0
It looks like this error is happening because the graph control is watching its collection of scales to determine whether the scale orientation changes have occurred, but the ColorScale does not have an orientation property. While you cannot do anything to your program to get around this error, you can safely ignore it. I have filed a bug report for this behavior.
Thank you for the feedback!
07-08-2015 06:10 PM
Great thank you!
07-08-2015
06:50 PM
- last edited on
11-20-2024
08:17 AM
by
Content Cleaner
No problem!
I have a follow up question for you. Is there a reason you don't just use the IntensityGraph class?
07-08-2015 07:10 PM
Oh yeah good question: we needed a color scale bar that can be used in other places where there was no NI control being used.
Thanks,
Gabe.
07-08-2019
04:04 PM
- last edited on
11-20-2024
08:17 AM
by
Content Cleaner
Just wanted to let you know this issue was fixed in the Measurement Studio 2019 release.