Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Host a PropertyEditor in a DataGridView cell

Solved!
Go to solution

Hi all,

 

I am using Net Measurement Studio in C# and I would like to know how can I host a PropertyEditor (for example, LineStyle as property for a plot object) in a DataGridView cell. Is it possible? how can I achieve this?

 

Thanks.

0 Kudos
Message 1 of 3
(5,201 Views)

Hi,

 

I have hosted a PropertyEditor into a datagridviewcolumn as a custom cell following the below approach:

 

http://msdn.microsoft.com/en-us/library/7tas5c80.aspx

 

but when my datagridview is loaded (columns/rows created), cell of type PropertyEditor are not visible until you do double-click. Also after double click below error is generated inmediatelly (in this case I have a propertyeditor whose source is object=ScatterPlot, propertyName=LineStep.

 

Error Details:

The type initializer for 'NationalInstruments.UI.Internal.WaveformPlotElement' threw an exception.The type initializer for 'NationalInstruments.PrecisionTimeSpan' threw an exception.Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

Stack Trace:

   at NationalInstruments.UI.Internal.WaveformPlotElement..ctor(Object obj)
   at NationalInstruments.UI.WaveformPlot.CreateElement()
   at NationalInstruments.UI.ControlEntity..ctor()
   at NationalInstruments.UI.Plot..ctor()
   at NationalInstruments.UI.CartesianPlot..ctor()
   at NationalInstruments.UI.XYPlot..ctor()
   at NationalInstruments.UI.XYPlot..ctor(XAxis xAxis, YAxis yAxis)
   at NationalInstruments.UI.WaveformPlot..ctor(XAxis xAxis, YAxis yAxis)
   at NationalInstruments.UI.Internal.Design.LineStepEditor.Draw(Graphics graphics, Rectangle bounds, Object item)
   at NationalInstruments.Internal.Design.PreviewDropDownEditor.DrawPreview(Graphics graphics, Rectangle bounds, Object item)
   at NationalInstruments.Internal.Design.PreviewDropDownEditor.PaintValue(PaintValueEventArgs e)
   at NationalInstruments.UI.WindowsForms.PropertyEditor.b.a(PaintEventArgs A_0)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

I am trying to solve two issues:

 

1) Why custom PropertyEditor cell is not visible?

2) Why after doubleclick on cell it crashes with the above message?

 

Thanks.

0 Kudos
Message 2 of 3
(5,172 Views)
Solution
Accepted by topic author tonitpp

By adding useLegacyV2RuntimeActivationPolicy="true" to app.config file in the project solved it.

 

<startup useLegacyV2RuntimeActivationPolicy="true">

            <supportedRuntime version="v4.0"/>

</startup>



 

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