Hi,
I created a ControlHostEditor based on feedback from IG support. This ControlHostEditor works perfectly for displaying all the different types of data I want, and hosting custom controls for editing, with one exception: boolean values.
As soon as I add a boolean value to the grid, I get the following error:
System.InvalidOperationException: 'ControlHostEditor' TargetType does not match type of element 'XamCheckEditor'.
How can I make the ControlHostEditor support boolean values so I do not get this error?
Thank you for your feedback. I am glad that the issue is resolved on your side.
Based on the stack trace you have provided our development team was able to reproduce the exception by setting FieldSettings.AllowRecordFiltering to ‘True’, FieldSettings.FilterOperandUIType to ‘UseFieldEditor’ and FieldLayoutSettings.FilterUIType to ‘FilterRecord’ in the XDGControlHostEditor sample that was previously attached. In that scenario the EditorType of the field could be set to ControlHostEditor to specify the custom editor’s type for that field:
grid1.FieldLayouts[0].Fields["IsPublished"].Settings.EditorType = typeof(ControlHostEditor);
I hope this information will be helpful for you and for any other community member that has a similar issue.
I created a new grid in my project, and created the config from scratch and have been unable to reproduce the problem. I now believe the problem was caused by a configuration issue, not the control
Here is the stack trace. I am trying to reproduce in the sample you provided.
Rbc.Velocity.Presentation.Workspaces.WorkspaceItemException: An error occurred in WorkspaceItem="Hollywood:igRandomGrid 1" ---> Rbc.Velocity.Presentation.Workspaces.Layouts.LayoutException: An error occurred in Layout="igRandomGrid" in WorkspaceItem="Hollywood:igRandomGrid 1" ---> System.InvalidOperationException: 'ControlHostEditor' TargetType does not match type of element 'XamCheckEditor'. at System.Windows.Style.CheckTargetType(Object element) at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache) at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.Editors.ValueEditor.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Infragistics.Windows.DataPresenter.Field.SetFilterCellEditorStyle(ValueEditor editor) at Infragistics.Windows.DataPresenter.Field.InitializeFilterCellEditor(ValueEditor editor) at Infragistics.Windows.DataPresenter.FilterCellValuePresenter.OnEditorCreated(ValueEditor editor) at Infragistics.Windows.Editors.ValuePresenter.ValidateEditorIsSited(Boolean templateApplied) at Infragistics.Windows.DataPresenter.DataItemPresenter.OnApplyTemplate() at Infragistics.Windows.DataPresenter.FilterCellValuePresenter.OnApplyTemplate() at System.Windows.FrameworkElement.ApplyTemplate() at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at Infragistics.Windows.DataPresenter.VirtualizingDataRecordCellPanel.TryGetPreferredExtentImpl(FieldLayoutItemBase fieldLayoutItem, Size newSize, FrameworkElement element, Int32 templateIndex, Boolean width) at Infragistics.Windows.DataPresenter.VirtualizingDataRecordCellPanel.TryGetPreferredExtent(FieldLayoutItemBase fieldLayoutItem, Boolean cell, Boolean width, Double& extent) at Infragistics.Windows.DataPresenter.CellLayoutItem.GetSize(LayoutItemSize size) at Infragistics.Windows.DataPresenter.LayoutItem.Infragistics.Controls.Layouts.Primitives.ILayoutItem.get_PreferredSize() at Infragistics.Controls.Layouts.Primitives.GridBagLayoutManager.GridBagConstraintCache..ctor(ILayoutItem item, IGridBagConstraint gc) at Infragistics.Controls.Layouts.Primitives.GridBagLayoutManager.GetGridBagCacheHelper(GridBagConstraintCache[]& tmpGccArr) at Infragistics.Controls.Layouts.Primitives.GridBagLayoutManager.CalculateGridBagLayout() at Infragistics.Controls.Layouts.Primitives.GridBagLayoutManager.CalculatePreferredSize(ILayoutContainer container, Object containerContext) at Infragistics.Windows.DataPresenter.FieldGridBagLayoutManager.CalculatePreferredSize() at Infragistics.Windows.DataPresenter.VirtualizingDataRecordCellPanel.MeasureOverride(Size availableSize) at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
I have tried reproducing the error by setting the style for the editor in a field that has a boolean values. When the grid is loaded the Checkbox controls are displayed in the IsPublished field of the grid as it is expected. I have tested this with the latest Service Release version of 14.1 - 14.1.20141.2216. Would you please run the project on your side and let me know if I am missing something in the scenario?Could you please also share a stack trace of the exception? Thank you.
Also note, I am using version 14.1