In one of my WPF projects, I have a UserControl as following:
<UserControl x:Class="Repository.UI.SetupModule.CalcRate.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ig="http://schemas.infragistics.com/xaml" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<Grid> <ig:XamComboEditor/> </Grid></UserControl>
I got the error on the XamComboEditor : Object reference not set to an instance of an object.
The StackTrace is:
at Infragistics.Controls.Editors.ComboEditorBase`2.OnApplyTemplate() at System.Windows.FrameworkElement.ApplyTemplate()
For testing purpose, I create a brand new WPF project, and add the same UserControl to the project, this time, there's no error on the XamCombeEditor.
I guess there must something in my project that causes the error, but unable to find out what it is.
please help, thanks.
Hi yingwu,
What is the version # on the Infragistics DLLs that you are using? I took a look in the latest source code available and inside ComboEditorBase.OnApplyTemplate(), every object being used has a null check around it so I can't see how you would be getting that exception. If I know what exact version you are using I can check that specific source code to see if there is anything different.
Hi Rob,
the version # for the InfragisticsWPF4.Controls.Editiors.XamComboEditor.v14.2.dll is 14.2.20142.1000.
Also, I have searched the whole solution for a style that might be targeting the ig:XamComboEditor, but found none. However, we do have a named style that targets the igWpf:XamComboEditor, not sure this has anything to do with the error.
Thank you very much for your help.
I encountered this exact error, and it is failing on those lines that access the popup resizer. However, I am running version 16.2.20162.2109.
The steps that led to this error are that I took a project developed against version 12.2, and used the version utility to switch to 16.2. Unknown to me, a previous developer had copied the Infragistics Metro Theme for this control into the project, per the instructions in Infragistic's documentation. The 12.2 version of the theme does not include a popup resizer.
Shouldn't the Version Utility recognize and update the themes? If not, this should probably have been listed as a breaking change in one of the versions in between.
Let me know if you have any further questions on this matter.
Thank you Rob.
Ok. With that namespace, igWpf:XamComboEditor will be the WPF only comboeditor. ig:XamComboEditor will be the Silverlight/WPF combo editor. Also your stack trace for the error points to the ig:XamComboEditor so we know it's not the WPF only version. I would say that your igWpf:XamComboEditor style probably doesn't have anything to do with it.
At this point I'd recommend downloading the source code from your account, building it (there is a batch file you can run for easy building), and then referencing those newly built DLLs in your project instead of the installed ones. Then reproduce the error. It should break inside the source code on the exact line where it's crashing. My best guess is that it cannot find that popup resizer but that should only occur if 1.) it couldn't find the default template for the editor, or 2.) you overlooked a style in the project that is changing the ig:XamComboEditor template. Without having a sample on my end that reproduces the issue I can't say for sure what the cause is. At least with the source code you will be able to see exactly why line it crashes on and we can then see what component it's trying to access.
here are the namespace for Infragistics in the xaml of my project:
xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:igEditors="http://infragistics.com/Editors" xmlns:igWpf="http://schemas.infragistics.com/xaml/wpf" xmlns:igDP="http://infragistics.com/DataPresenter" xmlns:igWindows="http://infragistics.com/Windows"
Thanks.