This is a migrated thread and some comments may be shown as answers.

RadPropertyGrid1_CreateItemElement works for visible items only

4 Answers 79 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 10 Jul 2020, 12:16 PM

I create the PropertyGrid in Dock Window.

This Window has a size less then PropertyGrid.

But: the function  RadPropertyGrid1_CreateItemElement works for visible items only and all unvisible is not created and it is the reason of exception.
How to  force the RadPropertyGrid1_CreateItemElement  works for all items in the propertyGrid ?

 

 

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Jul 2020, 12:30 PM

Hi, Oleg,

I would like to note that similar to RadGridView, RadListView, etc., RadPropertyGrid also uses data virtualization and visual item elements (PropertyGridItemElements) are created only for the currently visible items and they are being reused during operations like scrolling.

Could you please give us some more details about the exception you get and what is the exact requirement that you are trying to achieve? Once we get better understanding of the precise case, we would be able to think about a suitable solution and provide further assistance.

Thank you in advance. I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

0
Oleg
Top achievements
Rank 1
answered on 10 Jul 2020, 12:50 PM

There is the start of my task

https://www.telerik.com/forums/how-to-display-progressbar-in-a-propertygrid

 

I have an object which I display in my propertyGrid:

radPropertyGrid1.SelectedObject = m_db;

I have added yet one field to the end of object: it is integer value containing percents. I select it from a database.

I need to display the field as a progressbar. Nadya helped me (see the link above).

When the window has enough size and display entire propertygrid I see the function

RadPropertyGrid1_CreateItemElement 

enumerates all items including my progress field.

But if the window  does not display all of fields then 

the function enumerates only visible fields, and my progress field is unvisible. 

I scroll to the end of window to see the progress field and in that moment exception occurs. Btw, I even cannot  catch it and the app crashes immediately.

That is exception:

======================

Exception thrown: 'System.NullReferenceException' in Telerik.WinControls.UI.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>CinegyArchiveManager.exe</AppDomain><Exception><ExceptionType>System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Exception has been thrown by the target of an invocation.</Message><StackTrace>   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message&amp;amp; m)
   at Telerik.WinControls.RadControl.WndProc(Message&amp;amp; m)
   at Telerik.WinControls.UI.RadPropertyGrid.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp;amp; msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Cinegy_Archive_Manager.Program.Main() in D:\_GIT_Repo\CinegyArchive\cinegyarchive - CAM\CinegyArchiveManager\Cinegy Archive Manager\Program.cs:line 27</StackTrace><ExceptionString>System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message&amp;amp; m)
   at Telerik.WinControls.RadControl.WndProc(Message&amp;amp; m)
   at Telerik.WinControls.UI.RadPropertyGrid.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp;amp; msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Cinegy_Archive_Manager.Program.Main() in D:\_GIT_Repo\CinegyArchive\cinegyarchive - CAM\CinegyArchiveManager\Cinegy Archive Manager\Program.cs:line 27</ExceptionString><InnerException><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not set to an instance of an object.</Message><StackTrace>   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)</StackTrace><ExceptionString>System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)</ExceptionString></InnerException></Exception></TraceRecord>

======================

 

0
Nadya | Tech Support Engineer
Telerik team
answered on 13 Jul 2020, 01:16 PM

Hello, Oleg,

Your question has already been answered in the other thread you have opened on the same topic - ticket ID 1475274. You can find it in your Telerik account. Please, see our answer there for more information.

We kindly ask you to use just one thread for a specific problem to contact us. Thank you for understanding.

Regards,
Nadya
Progress Telerik

0
Oleg
Top achievements
Rank 1
answered on 13 Jul 2020, 01:18 PM
Sorry, Nadya
Tags
PropertyGrid
Asked by
Oleg
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Oleg
Top achievements
Rank 1
Nadya | Tech Support Engineer
Telerik team
Share this question
or