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.
It depends on what the namespace igWpf is set to in the xaml. At the top of the xaml file that has igWpf in it, what is the value for xmlns:igWpf=?
I went over the source code for 14.2.20142.1000 and most of the code inside OnApplyTemplate is the same. One thing I overlooked the first time I checked the source code was a piece of code that was looking for a popup resizer:
this._resizer = this._rootPopupParent.FindName("Resizer") as PopupResizer;this._resizer.PopupResizing += Resizer_PopupResizing; this._resizer.PopupResized += Resizer_PopupResized;
There is no null check around the PopupResizing events so maybe this is where it's causing the exception for you? In the default styles for the XamComboEditor template I can see the resizer control that it's looking for so as long as you haven't changed that, it should find it.
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.