From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

GraphInteractionPalette throws System.NotSupportedException

Hello,

 

I'm using GraphInteractionPalette in my C# WPF application and wanted to report an exception that is being logged to the debug window. This exception is not being thrown, so I assume the control is handling it, but I'm not sure if it's something to be concerned about.

 

The following exception is thrown 9 times (I assume one for each button on the palette):

 

System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.ImageSource' for 'en-US' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: ImageSourceConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'

 

My XAML contains the GraphInteractionPalette:

 

                <StackPanel DockPanel.Dock="Left" Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
                    <ni:GraphInteractionPalette x:Name="_graphInteractionPalette" VerticalAlignment="Center"/>
                    ...
                </StackPanel>

 

And I assign the Graph in code-behind:

 

            _graphInteractionPalette.Graph = _graph;

 

The exception is thrown when the control is loaded. All the palette buttons work, but just wanted to see if I'm missing something.

 

Thanks!

0 Kudos
Message 1 of 5
(5,895 Views)

Thank you for the report. The "System.Windows.Data Error" text indicates that these errors occur during binding: it appears that the image paths in the default template for the graph tool palette are evaluating to null before receiving their final value. As you noted, this does not effect the runtime functionality or appearance of the control, but I have created a task to look at fixing the binding errors and avoid polluting the output window.

~ Paul H
0 Kudos
Message 2 of 5
(5,885 Views)

Is the task for solving this problem still open?

Look at http://stackoverflow.com/questions/5399601/imagesourceconverter-error-for-source-null for a solution.

0 Kudos
Message 3 of 5
(5,643 Views)

Thank you for the link!  I have added it to the notes for the task.

~ Paul H
0 Kudos
Message 4 of 5
(5,637 Views)

Just wanted to let you know this issue (#402863) was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 5 of 5
(4,329 Views)