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

RadGridView in 2012 Q3 throws an Exception {"Add value to collection of type 'System.Windows.Controls.UIElementCollection' threw an exception."}

8 Answers 329 Views
GridView
This is a migrated thread and some comments may be shown as answers.
G
Top achievements
Rank 1
G asked on 08 Jan 2013, 12:21 PM
Hi, i have recently switched to 2012 Q3 and now the view  throws an Exception when loading the radgridview in the UI. Any ideas? 

Thanks in advance.

View : 

    <telerik:RadGridView x:Name="dg1"
     Grid.Row="1" Grid.ColumnSpan="2"
                                     ColumnWidth="*" UseLayoutRounding="False"
                                     ItemsSource="{Binding FilterView}"
                                     SelectionMode="Extended"
                                     SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                     AutoGenerateColumns="False" Margin="5" ShowGroupPanel="False"
                                     RowIndicatorVisibility="Collapsed"
                                     CanUserDeleteRows="False"
                                     CanUserFreezeColumns="False"
                                     CanUserInsertRows="False"
                                     IsReadOnly="True"
                                     IsFilteringAllowed="False">

                    <i:Interaction.Behaviors>
                        <Behaviors:RadGridViewMultiSelectorBehavior
                            SelectedItems="{Binding SelectedItems, Mode=TwoWay}" />
                    </i:Interaction.Behaviors>

                    <telerik:RadGridView.InputBindings>
                        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Edit}" />
                    </telerik:RadGridView.InputBindings>
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="{loc:Localize name, STV}" Width="*"
                                                    DataMemberBinding="{Binding Name}" />
                        <telerik:GridViewDataColumn Header="{loc:Localize type, STV}" Width="*"
                                                    DataMemberBinding="{Binding WorkflowInfo.DisplayName, Converter={StaticResource LocalizationConverter}, ConverterParameter=STV}" />
                        <telerik:GridViewDataColumn Header="{loc:Localize created, STV}"
                                                    DataMemberBinding="{Binding DateCreated, StringFormat='d', ConverterCulture={x:Static Globalization:CultureInfo.CurrentCulture}}"
                                                    Width="Auto" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>


XAMLParseException ocurred

Add value to collection of type 'System.Windows.Controls.UIElementCollection' threw an exception.

Inner Exception: {"Value cannot be null.\r\nParameter name: element"}


 
 at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)<br>
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)<br>
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)<br>
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)<br>
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)<br>
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)<br>
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)<br>
   at System.Windows.FrameworkElement.ApplyTemplate()<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)<br>
   at Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size availableSize)<br>
   at Telerik.Windows.Controls.GridView.GridViewHeaderRow.MeasureOverride(Size availableSize)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)<br>
   at Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)<br>
   at Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size availableSize)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<br>
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<br>
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.Controls.Page.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<br>
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<br>
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<br>
   at System.Windows.UIElement.Measure(Size availableSize)<br>
   at System.Windows.ContextLayoutManager.UpdateLayout()<br>
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)<br>
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()<br>
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()<br>
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)<br>
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)<br>
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)<br>
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)<br>
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()<br>
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)<br>
   at System.Threading.ExecutionContext.runTryCode(Object userData)<br>
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<br>
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<br>
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<br>
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br>
   at System.Windows.Threading.DispatcherOperation.Invoke()<br>
   at System.Windows.Threading.Dispatcher.ProcessQueue()<br>
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)<br>
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)<br>
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)<br>
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)<br>
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)<br>
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)<br>
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)<br>
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)<br>
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)<br>
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)<br>
   at System.Windows.Application.RunDispatcher(Object ignore)<br>
   at System.Windows.Application.RunInternal(Window window)<br>
   at System.Windows.Application.Run(Window window)<br>
   at System.Windows.Application.Run()<br>
   at STV.Application.StartUp.Main(String[] args) 


8 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 08 Jan 2013, 01:35 PM
Hello,

I have checked the case, but I were not able to reproduce such an error.

May I ask you to check if the reason for it is the way you currently assign the header:

Header="{loc:Localize name, STV}"
If it is not this, then would it be possible for you to isolate the source of the problem?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
G
Top achievements
Rank 1
answered on 08 Jan 2013, 01:46 PM
Hi Didie, thanks for the quick answer. That class is used for translating porpuses. I have removed unnecesary things and i hope this code will work for you (it's still giving the same exception) 

Thanks 

                       <telerik:RadGridView Grid.Row="1" Grid.ColumnSpan="2"
                                     ColumnWidth="*" UseLayoutRounding="False"
                                     ItemsSource="{Binding FilterView}"
                                     SelectionMode="Extended"
                                     SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                     AutoGenerateColumns="False" Margin="5" ShowGroupPanel="False"
                                     RowIndicatorVisibility="Collapsed"
                                     CanUserDeleteRows="False"
                                     CanUserFreezeColumns="False"
                                     CanUserInsertRows="False"
                                     IsReadOnly="True"
                                     IsFilteringAllowed="False">

         <!--<i:Interaction.Behaviors>
                        <Behaviors:RadGridViewMultiSelectorBehavior
                            SelectedItems="{Binding SelectedItems, Mode=TwoWay}" />
                    </i:Interaction.Behaviors>-->

                    <telerik:RadGridView.InputBindings>
                        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Edit}" />
                    </telerik:RadGridView.InputBindings>
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="name" Width="*"/>
                        <telerik:GridViewDataColumn Header="type" Width="*"/>
                        <telerik:GridViewDataColumn Header="created" Width="Auto" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>

0
Dimitrina
Telerik team
answered on 08 Jan 2013, 01:57 PM
Hi,

I have tested using the exact code you have pasted with the version 2012.3.1129 (2012 Q3 SP RadControls for WPF). So far I could not encounter any problems.

What is the version do you use? May I ask you to please send us a demo project which we could run locally to further investigate the case?
 

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
G
Top achievements
Rank 1
answered on 08 Jan 2013, 02:10 PM
Hi, i have noticed that the exception is caused by a radBusyIndicator that surrounds the grid. Maybe in the Q3 should be place in a higher level or used in another way?

<telerik:RadBusyIndicator IsBusy="{Binding IsExportingTask}" BusyContent="ExportingTask...">
                <telerik:RadGridView Grid.Row="1" Grid.ColumnSpan="2"
                                     ColumnWidth="*" UseLayoutRounding="False"
                                     ItemsSource="{Binding FilterView}"
                                     SelectionMode="Extended"
                                     SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                     AutoGenerateColumns="False" Margin="5" ShowGroupPanel="False"
                                     RowIndicatorVisibility="Collapsed"
                                     CanUserDeleteRows="False"
                                     CanUserFreezeColumns="False"
                                     CanUserInsertRows="False"
                                     IsReadOnly="True"
                                     IsFilteringAllowed="False">

         <!--<i:Interaction.Behaviors>
                        <Behaviors:RadGridViewMultiSelectorBehavior
                            SelectedItems="{Binding SelectedItems, Mode=TwoWay}" />
                    </i:Interaction.Behaviors>-->

                    <telerik:RadGridView.InputBindings>
                        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Edit}" />
                    </telerik:RadGridView.InputBindings>
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="name" Width="*"/>
                        <telerik:GridViewDataColumn Header="type" Width="*"/>
                        <telerik:GridViewDataColumn Header="created" Width="Auto" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
</telerik:RadBusyIndicator>

0
Dimitrina
Telerik team
answered on 08 Jan 2013, 02:35 PM
Hi,

Thank you for that additional information, but I am still not able to reproduce the error. I have attached my test project. Would you please check it and let me know if I have missed anything?
 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
G
Top achievements
Rank 1
answered on 09 Jan 2013, 10:29 AM
Your test project works right in my pc but the version of the dlls  you are using is 2012.3.1017.40 and  the version I'm using is 2012.3.1126.40. So maybe my problem is related to this version...
0
Accepted
Dimitrina
Telerik team
answered on 09 Jan 2013, 10:43 AM
Hi,

Unfortunately you are right. I attached the project with version 2012 Q3 (2012.3.1017.40) as this was specified in your first post. Now I tested with the next version 2012.3.1129 (2012 Q3 SP) and the problem introduced with the lib seems to be resolved. Would you please upgrade to that official version?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
G
Top achievements
Rank 1
answered on 09 Jan 2013, 10:46 AM
Ok, many thanks.
Tags
GridView
Asked by
G
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
G
Top achievements
Rank 1
Share this question
or