I'm using the XamDataGrid to show and change my hierarchical business objects.
One of my fields looks like this:
<igDP:UnboundField Name="Size" Label="My Size" x:Name="fldSize" Width="Auto"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowEdit="False" EditorType="{x:Type igEditors:XamTextEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="Value"> <Setter.Value> <MultiBinding Converter="{StaticResource SizeToDimensionsStringMultiConverter}"> <Binding Path="Record.DataItem.Size.Width" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type igDP:DataRecordCellArea}}"/> <Binding Path="Record.DataItem.Size.Height" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type igDP:DataRecordCellArea}}"/> </MultiBinding> </Setter.Value> </Setter> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>
If I scroll through my data records (vertical direction) randomly the value (e.g. Size) of some records is beeing set although I haven't changed anything.
How is this possible? What can I do to stop this behaviour?
Hello Darius,
Thank you for your post. I have been looking into it, but it seems like that I am missing something in your scenario, 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.
Hello Stefan,
the isolated sample project is not finished yet, but maybe the Call Stack helps to understand my problem.
I made this snapshot of the Call Stack in the ConvertBack method of my IMultiValueConverter while I was scrolling through the data records.
The ConvertBack method is called by
InfragisticsWPF4.Editors.v12.1.dll!Infragistics.Windows.Editors.ValueEditor.Value.set(object value) + 0x3f bytes
via the PresentationFrameWork.
This is happening randomly.
Any suggestions why this happens?
Sincerely,
Darius
> WpfPrototype.exe!De.Client.RichClient.Converters.SizeToDimensionsStringMultiConverter.ConvertBack(object value, System.Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) Line 96 C# PresentationFramework.dll!System.Windows.Data.MultiBindingExpression.GetValuesForChildBindings(object rawValue) + 0x1a3 bytes PresentationFramework.dll!System.Windows.Data.MultiBindingExpression.ConvertProposedValueImpl(object value, out object result) + 0x65 bytes PresentationFramework.dll!System.Windows.Data.MultiBindingExpression.ConvertProposedValue(object value) + 0x27 bytes PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.UpdateValue() + 0x5f bytes PresentationFramework.dll!System.Windows.Data.MultiBindingExpression.SetValue(System.Windows.DependencyObject d, System.Windows.DependencyProperty dp, object value) + 0xd3 bytes WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) + 0x3c1 bytes WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x76 bytes InfragisticsWPF4.Editors.v12.1.dll!Infragistics.Windows.Editors.ValueEditor.Value.set(object value) + 0x3f bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.CellValuePresenter.InitializeCellLevelSettings(Infragistics.Windows.DataPresenter.DataRecord newRecord, Infragistics.Windows.DataPresenter.DataRecord oldRecord, Infragistics.Windows.DataPresenter.Field newField, Infragistics.Windows.DataPresenter.Field oldField, bool isWithinRecord) + 0x3a7 bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.CellValuePresenter.InitializeRecord(Infragistics.Windows.DataPresenter.DataRecord newRecord, Infragistics.Windows.DataPresenter.DataRecord oldRecord) + 0x1e5 bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.CellValuePresenter.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x29e bytes WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0xf8 bytes WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) + 0x54c bytes PresentationFramework.dll!System.Windows.TreeWalkHelper.OnInheritablePropertyChanged(System.Windows.DependencyObject d, System.Windows.InheritablePropertyChangeInfo info) + 0x2cc bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>._VisitNode(System.Windows.DependencyObject d) + 0xa1 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.VisitNode(System.Windows.FrameworkElement fe) + 0xc2 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkLogicalChildren(System.Windows.FrameworkElement feParent, System.Windows.FrameworkContentElement fceParent, System.Collections.IEnumerator logicalChildren) + 0x94 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkFrameworkElementLogicalThenVisualChildren(System.Windows.FrameworkElement feParent, bool hasLogicalChildren) + 0x90 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.IterateChildren(System.Windows.DependencyObject d) + 0x147 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>._VisitNode(System.Windows.DependencyObject d) + 0xbd bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.VisitNode(System.Windows.FrameworkElement fe) + 0xc2 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkLogicalChildren(System.Windows.FrameworkElement feParent, System.Windows.FrameworkContentElement fceParent, System.Collections.IEnumerator logicalChildren) + 0x94 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkFrameworkElementLogicalThenVisualChildren(System.Windows.FrameworkElement feParent, bool hasLogicalChildren) + 0x90 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.IterateChildren(System.Windows.DependencyObject d) + 0x147 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>._VisitNode(System.Windows.DependencyObject d) + 0xbd bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.VisitNode(System.Windows.FrameworkElement fe) + 0xc2 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkLogicalChildren(System.Windows.FrameworkElement feParent, System.Windows.FrameworkContentElement fceParent, System.Collections.IEnumerator logicalChildren) + 0x94 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkFrameworkElementLogicalThenVisualChildren(System.Windows.FrameworkElement feParent, bool hasLogicalChildren) + 0x90 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.IterateChildren(System.Windows.DependencyObject d) + 0x147 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>._VisitNode(System.Windows.DependencyObject d) + 0xbd bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.VisitNode(System.Windows.FrameworkElement fe) + 0xc2 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.WalkFrameworkElementLogicalThenVisualChildren(System.Windows.FrameworkElement feParent, bool hasLogicalChildren) + 0x1de bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.IterateChildren(System.Windows.DependencyObject d) + 0x147 bytes PresentationFramework.dll!System.Windows.DescendentsWalker<System.Windows.InheritablePropertyChangeInfo>.StartWalk(System.Windows.DependencyObject startNode, bool skipStartNode) + 0x145 bytes PresentationFramework.dll!System.Windows.TreeWalkHelper.InvalidateOnInheritablePropertyChange(System.Windows.FrameworkElement fe, System.Windows.FrameworkContentElement fce, System.Windows.InheritablePropertyChangeInfo info, bool skipStartNode) + 0x188 bytes PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0xe3a bytes WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0xf8 bytes WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) + 0x54c bytes WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) + 0x320 bytes WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x76 bytes PresentationFramework.dll!System.Windows.Controls.ContentPresenter.OnContentChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) + 0x32a bytes WindowsBase.dll!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0xdc bytes PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0x271 bytes WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0xf8 bytes WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) + 0x54c bytes PresentationFramework.dll!System.Windows.StyleHelper.InvalidateDependents(System.Windows.Style ownerStyle, System.Windows.FrameworkTemplate frameworkTemplate, System.Windows.DependencyObject container, System.Windows.DependencyProperty dp, ref MS.Utility.FrugalStructList<System.Windows.ChildPropertyDependent> dependents, bool invalidateOnlyContainer) + 0x2de bytes PresentationFramework.dll!System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(System.Windows.Style ownerStyle, System.Windows.FrameworkTemplate frameworkTemplate, System.Windows.DependencyObject container, System.Windows.DependencyProperty dp, System.Windows.DependencyPropertyChangedEventArgs changedArgs, bool invalidateOnlyContainer, ref MS.Utility.FrugalStructList<MS.Utility.ItemStructMap<System.Windows.TriggerSourceRecord>> triggerSourceRecordFromChildIndex, ref MS.Utility.FrugalMap propertyTriggersWithActions, int sourceChildIndex) + 0x198 bytes PresentationFramework.dll!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0xcde bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.RecordPresenter.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0xa9 bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.DataRecordPresenter.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs e) + 0xa6 bytes WindowsBase.dll!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs args) + 0xf8 bytes WindowsBase.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex entryIndex, System.Windows.DependencyProperty dp, System.Windows.PropertyMetadata metadata, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType) + 0x54c bytes WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp, object value, System.Windows.PropertyMetadata metadata, bool coerceWithDeferredReference, bool coerceWithCurrentValue, System.Windows.OperationType operationType, bool isInternal) + 0x320 bytes WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty dp, object value) + 0x76 bytes InfragisticsWPF4.v12.1.dll!Infragistics.Windows.Virtualization.RecyclingItemContainerGenerator.ConnectContainerToItem(Infragistics.Windows.Virtualization.RecyclingItemContainerGenerator.ContainerReference cr) + 0xf8 bytes InfragisticsWPF4.v12.1.dll!Infragistics.Windows.Virtualization.RecyclingItemContainerGenerator.RecyclingGenerator.GenerateNext(bool returnNullIfAlreadyRealized, out bool isNewlyRealized) + 0x8e2 bytes InfragisticsWPF4.v12.1.dll!Infragistics.Windows.Virtualization.RecyclingItemContainerGenerator.GenerateNext(out bool isNewlyRealized) + 0xaa bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.GridViewPanelFlat.GenerationCache.GenerateNextElement(bool isHeader) + 0x20e bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.GridViewPanelFlat.GenerationCache.GenerateScrollableRecords() + 0x68b bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.GridViewPanelFlat.GenerationCache.GenerateAllRecords() + 0xc7 bytes InfragisticsWPF4.DataPresenter.v12.1.dll!Infragistics.Windows.DataPresenter.GridViewPanelFlat.MeasureOverride(System.Windows.Size availableSize) + 0xc5b bytes PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize) + 0x3f9 bytes PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x5d5 bytes PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() + 0x59c bytes PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg) + 0x22 bytes PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() + 0x95 bytes PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget) + 0xdf bytes PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget) + 0x5d bytes WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5a bytes WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) + 0x5d bytes WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0xb1 bytes mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x178 bytes [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xa1 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x3b bytes WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x6d bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x27f bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xb3 bytes WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x13d bytes WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x97 bytes WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x5a bytes WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x47 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) + 0x5d bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0xd2 bytes WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x164 bytes [Native to Managed Transition] [Managed to Native Transition] WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0x13a bytes PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x12f bytes PresentationFramework.dll!System.Windows.Application.Run() + 0xbb bytes ScpWpfPrototype.exe!De.Scp.Client.RichClient.App.Main() + 0x77 bytes C# [Native to Managed Transition] [Managed to Native Transition] Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x48 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xdc bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x3b bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x4d bytes [Native to Managed Transition]
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Overriding Equals did the magic.
Thank you for your support.
Sincerly,
I have modified the sample further, so now the Business objects updates correctly. Basically I override the Equals method of the Clinic class, so the object now are compared by their Name property, not by reference. Please let me know if this helps you or you need further assistance on this matter.
Hi,
in your sample you are just setting the value within the combobox but not in the bussinesobject.
I have modified the sample you have sent me, so now it works as you want. Basically instead of setting the SelectedItem of the XamCombopEditor, I set its Value. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.