Hi Guys,
I am using combox in side the igDP:XamDataGrid .. in this version if i set IsSynchronizedWithCurrentItem="false" then it works fine and when it is true then getting exception. to implement my business logic i have to set it true.
Business logic : If user selects any value from combox at UI. but the selected value is not correct according to business logic then a message box is displayed with text message "this is not correct value". So user clicks on ok button on message box then after the pervious value should be displayed in same row of grid. but when user clicks on ok button then after OnValueChanged() method call and exception occures.
Kindly help. Many Many Thanks in advanced!!!!!
here is XMAL code:
<igDP:XamDataGrid Name="customerGroupAgreementDataGrid" TabIndex="13" RecordContainerGenerationMode = "PreLoad" DataSource="{Binding Path=CustomerGroupAgreementsItemsSource,Mode=TwoWay}" acb:CommandBehavior.Event="CellUpdated" acb:CommandBehavior.Command="{Binding Path= GroupAgreementAddedCommand}" acb:CommandBehavior.CommandParameter="{Binding ElementName=customerGroupAgreementDataGrid, Path=ActiveRecord.DataItem}" BorderBrush="LightSteelBlue" BorderThickness="2" Background="AliceBlue" Theme="Office2k7Blue" AutoFit="False" GroupByAreaLocation="None" IsSynchronizedWithCurrentItem="True" Grid.Column="2" Grid.ColumnSpan="3" Grid.RowSpan="4" Margin="5" Grid.Row="5" Height="150" CellChanged="customerGroupAgreementDataGrid_CellChanged" > <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="ToolTip" Value="{Localize dataGridTooltip}" /> </Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" AllowDelete="False" AddNewRecordLocation="OnBottom" SelectionTypeCell="Extended" SelectionTypeField="None" SelectionTypeRecord="Single" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="Value" Label="{Localize customerGroupAgreement}" Width="300"> <igDP:Field.Settings> <igDP:FieldSettings LabelClickAction="Nothing" EditorType="{x:Type infraEditor:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type infraEditor:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{Binding Source={StaticResource MP}}" /> <Style.Triggers> </Style.Triggers> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Error :
Message : PresentationException occured in App.Application_DispatcherUnhandledException () failed., message: , transactionID: Not availableSource : Help link : Data : System.Collections.ListDictionaryInternalTargetSite : Stack Trace : The stack trace is unavailable.Additional Info:
Inner Exception --------------- Type : System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Object reference not set to an instance of an object. Source : InfragisticsWPF4.DataPresenter.v14.1 Help link : Data : System.Collections.ListDictionaryInternal TargetSite : Void OnValueChanged() Stack Trace : at Infragistics.Windows.DataPresenter.CellValuePresenter.OnValueChanged() at Infragistics.Windows.Editors.ValueEditor.OnValueChanged(Object previousValue, Object currentValue) at Infragistics.Windows.Editors.ValueEditor.OnValueChanged(DependencyObject dependencyObject, 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 Infragistics.Windows.Editors.TextEditorBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at Infragistics.Windows.Editors.XamComboEditor.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.SetCurrentValue(DependencyProperty dp, Object value) at Infragistics.DependencyPropertyUtilities.SetCurrentValue(DependencyObject d, DependencyProperty property, Object newValue) at Infragistics.Windows.Editors.XamComboEditor.Sync_SetValueHelper(DependencyProperty prop, Object value, ValueChangeSource changeSource) at Infragistics.Windows.Editors.XamComboEditor.OnValueChanged_SyncPropertiesHelper(ValueChangeSource source, Object value) at Infragistics.Windows.Editors.XamComboEditor.OnValueChanged_SyncProperties(ValueChangeSource source, Object value, Boolean calledFromSyncValuePropertiesOverride) at Infragistics.Windows.Editors.XamComboEditor.OnComboBox_SelectionChanged(Object sender, SelectionChangedEventArgs e) at System.Windows.Controls.SelectionChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.Controls.ComboBox.OnSelectionChanged(SelectionChangedEventArgs e) at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems) at System.Windows.Controls.Primitives.Selector.SelectionChanger.End() at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(Object item, Boolean assumeInItemsCollection) at System.Windows.Controls.ComboBox.NotifyComboBoxItemMouseUp(ComboBoxItem comboBoxItem) at System.Windows.Controls.ComboBoxItem.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 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)
Category: ErrorPriority: 0EventId: 40090Severity: Error
Below is teh quic watch exception details.
- TargetSite {Void OnValueChanged()} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}+ [System.Reflection.RuntimeMethodInfo] {Void OnValueChanged()} System.Reflection.RuntimeMethodInfo- base {Void OnValueChanged()} System.Reflection.MemberInfo {System.Reflection.RuntimeMethodInfo}+ DeclaringType {Name = "CellValuePresenter" FullName = "Infragistics.Windows.DataPresenter.CellValuePresenter"} System.Type {System.RuntimeType} MemberType Method System.Reflection.MemberTypes MetadataToken 100664596 int+ Module {InfragisticsWPF4.DataPresenter.v14.1.dll} System.Reflection.Module {System.Reflection.RuntimeModule} Name "OnValueChanged" string- ReflectedType {Name = "CellValuePresenter" FullName = "Infragistics.Windows.DataPresenter.CellValuePresenter"} System.Type {System.RuntimeType}+ [System.RuntimeType] {Name = "CellValuePresenter" FullName = "Infragistics.Windows.DataPresenter.CellValuePresenter"} System.RuntimeType+ base {Name = "CellValuePresenter" FullName = "Infragistics.Windows.DataPresenter.CellValuePresenter"} System.Reflection.MemberInfo {System.RuntimeType}+ Assembly {InfragisticsWPF4.DataPresenter.v14.1, Version=14.1.20141.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb} System.Reflection.Assembly {System.Reflection.RuntimeAssembly} AssemblyQualifiedName "Infragistics.Windows.DataPresenter.CellValuePresenter, InfragisticsWPF4.DataPresenter.v14.1, Version=14.1.20141.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" string Attributes Public System.Reflection.TypeAttributes+ BaseType {Name = "DataItemPresenter" FullName = "Infragistics.Windows.DataPresenter.DataItemPresenter"} System.Type {System.RuntimeType} ContainsGenericParameters false bool+ DeclaringMethod '(((System.Reflection.MemberInfo)((e._exception).TargetSite)).ReflectedType).DeclaringMethod' threw an exception of type 'System.InvalidOperationException' System.Reflection.MethodBase {System.InvalidOperationException}+ DeclaringType null System.Type FullName "Infragistics.Windows.DataPresenter.CellValuePresenter" string- GenericParameterAttributes '(((System.Reflection.MemberInfo)((e._exception).TargetSite)).ReflectedType).GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException' System.Reflection.GenericParameterAttributes {System.InvalidOperationException}+ base {"Method may only be called on a Type for which Type.IsGenericParameter is true."} System.SystemException {System.InvalidOperationException}+ GenericParameterPosition '(((System.Reflection.MemberInfo)((e._exception).TargetSite)).ReflectedType).GenericParameterPosition' threw an exception of type 'System.InvalidOperationException' int {System.InvalidOperationException}+ GUID {ddc13ec4-7006-31a5-9956-a74c54fe2ba4} System.Guid
Hello Anil,
Thank you for your post. I have been looking into it, but since I cannot be completely sure how your data is organized and how you bind the XamComboEditor to it, I am not able to conclude what can cause this issue, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Hi Stefan,
As per the above post you can understand that we are using infraEditor:XamComboEditor inside the XamDataGrid. Below is the code of combbox editor. complete code with grid is already shared in pervious post also.
</Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" AllowDelete="False" AddNewRecordLocation="OnBottom" SelectionTypeCell="Extended" SelectionTypeField="None" SelectionTypeRecord="Single" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="Value" Label="{Localize customerGroupAgreement}" Width="300"> <igDP:Field.Settings> <igDP:FieldSettings LabelClickAction="Nothing" EditorType="{x:Type infraEditor:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type infraEditor:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{Binding Source={StaticResource MP}}" /> <Style.Triggers> </Style.Triggers> </Style>
When user selects any value from combo box then below method is called in app.XMAl.cs file.
private void OnGridCellChanged(object sender, CellChangedEventArgs e)
{
try
CellValuePresenter cvp = e.Editor.Host as CellValuePresenter;
if (e.Editor.Value != null && e.Editor.Value.ToString() != String.Empty)
cvp.Value = e.Editor.Value;
}else
cvp.Value = String.Empty;
}
catch (Exception)
throw ;
In this method we got a exception in event argument CellChangedEventArgs e
Could you please help what is the work arround for this exception.
Many Thanks in Advance!
Anil
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it so it reproduces your issue and send it back to us, so we could be able to investigate it further for you.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.