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

Exception when adding FilterDescriptor

4 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Uli
Top achievements
Rank 1
Uli asked on 16 Aug 2010, 11:18 AM
Hi,

I'm using the RadGridView with a custon filter row like it is shown in one of the demo samples. I also have on custom column configuration dialog that is used to add, remove or reorder columns. When the column configuration is modified within this dialog I first remove all Columns and FilterDescriptors. Then I add the columns again according to the new configuration. When I try to add the FilterDescriptors I get an exception with the following message and stacktrace:

Object reference not set to an instance of an object.

   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

I'm adding the FilterDescriptors in the DataType PropertyChanged event of the columns. I'm doing it this way because otherwise the correct DataType is not available.

When I add the same FilterDescriptors some time later in the click event handler of a button, the exception does not occur.

Any suggestions? Is there another event that is fired some time after DataType PropertyChanged event of the columns and can be used to add the FilterDescriptors.

Regards,

Uli

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 16 Aug 2010, 11:54 AM
Hello Uli,

Why don't you try to add all FilterDescriptors after all columns have been added and data has been loaded. You can do this in the DataLoaded event of the grid. Maybe this will help.

Kind regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Uli
Top achievements
Rank 1
answered on 16 Aug 2010, 12:46 PM
Hello Ross,

the DataLoaded is only fired once when the grid is loaded for the first time. It is not fired again when I just remove and add the columns and FilterDescriptors.

Regards, Uli
0
Uli
Top achievements
Rank 1
answered on 16 Aug 2010, 01:28 PM
Hi Ross,

my last response was not correct. The DataLoaded event is fired again. But when it is fired, the DataType property of the columns is still null. Thus it is not possible to set the correct custom filter type.

Kind regards,

Uli
0
Rossen Hristov
Telerik team
answered on 16 Aug 2010, 01:34 PM
Hi Uli,

If I understand correctly, it is you that adds the columns. Don't you know their type or am I completely missing something? Can prepare a small sample project, open a separate support ticket and attach it. We will then take a look at it. Thanks in advance.

Regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Uli
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Uli
Top achievements
Rank 1
Share this question
or