I have an issue using XamMultiColumnComboEditor v16.1 within a DataTemplate.
<DataTemplate DataType="{x:Type fields:HistoryClientInfoFieldViewModel}">
<ig:XamMultiColumnComboEditor ItemsSource="{Binding Values}" AutoGenerateColumns="False" SelectedValuePath="Name" DropDownButtonDisplayMode="Always" SelectedItemsResetButtonVisibility="Collapsed" Width="250"> <ig:XamMultiColumnComboEditor.Columns> <ig:TextComboColumn HeaderText="Name" Key="Name"/> <!--<ig:TextComboColumn HeaderText="OrderPlacer" Key="OrderPlacer"/>--> </ig:XamMultiColumnComboEditor.Columns> </ig:XamMultiColumnComboEditor> </DataTemplate>
First when setting the focus on the element there is an exception
exception thrown: 'System.InvalidOperationException' in PresentationCore.dll
Additional information: This Visual is not connected to a PresentationSource.
When attempting to set the value on the second time a null reference exception occurs.
Using the control inside a UserControl seems to work for some reason.
Any idea what is going wrong?
Thanks
Hi Etienne,
That's an interesting error. How are you using that DataTemplate? I see it has a DataType set which means it will automatically apply where HistoryClientInfoFieldViewModel is used but what parent control is expected to use this DataTemplate? For example, I tried creating a ListView control and used that DataTemplate for each list item but did not produce any exception when focusing via Mouse click or Tabbing to it. I tested using the last service release for 16.1 (16.1.20161.2231).
Also, do you have a stack trace for the error? I'm interested to see what method calls in the XamMultiColumnComboEditor are triggering the exception.
It is used in an items control containing other field model.So it is pretty much implicit datatamplte.The "expected parent" is simply a contentcontrol.
Oddly enough we dont get any stacktrace of the error.
Ok, try turning on "Common Language Runtime Exceptions" and reproducing the exception. This option is in Visual Studio in the top menu (Debug -> Windows -> Exception Settings). Maybe there is an exception before the one you see that is handled and that puts things into a bad state causing this one. So we'll want to break on that exception instead of handling it. Not really sure but worth a shot. Also, make sure you check the inner exception on the exception you see as most times with things like this the true exception is hidden in there. The exception dialog should have a "View Detail" option at the bottom.
I tried switching my ListView to an ItemsControl and I just let the implicit DataTemplate do its thing but I still don't see an exception when focusing the combo editor. I have attached my sample (it's very basic) so let me know if there's anything I'm missing that is required to reproduce this.
0564.ComboEditorImplicitTemplate.zip
All exceptions were turned on when i encountered the error. And no details options in the exception window
Also it is used in an items control with wrap panel as a panel template
I switched to a WrapPanel as the ItemsPanel but that didn't seem to change anything. Can you update the sample I attached in my last update to reproduce the exception and then send it back to me so I can debug it?
Trying to reproduce the issue.
Doesnt occur by simply putting the into a template.
So havnt found a way to reproduce it in a simple project.
The only thing new i found is that the exception only occur if I click on a an area with text. The adventure got a lot stranger.
So ill keep trying to repoduce it.
I created a private support case for you to track the dev issue I logged. The case number is CAS-189707-R7S0Q4 and you can view it here: https://ko.infragistics.com/my-account/support-activity
I logged a dev issue for this so our engineers can make some changes around that code to account for null values getting passed to the GetParent() method. While I was not able to reproduce this locally the GetUIElementParent() method is very small and there are only two places where LogicalTreeHelper.GetParent() are called so I figured it would be ok to log this along with the call stack you provided. The dev issue ID is 247206.
For now, continue to use your workaround. I will open a private support case for you soon where I will link to this dev issue so you can track its status. Be aware that development has stopped for 16.2 and below so any fix that is made will be in 17.1 and above. Once the case is created I will update this thread and let you know.
We host elements in xamdatagrid styled as a list view.
Elements support drag and drop using drag drop manager. We use the drag drop manager to merge entries in the grid.
So at some point upon clicking an element on the grid inside the editor I've seen the drag drop procedure is activated on the MouseLeftButtonDown but unsuccessfully find a parent.
Hmm. I actually do see the possibility for an ArgumentNullException in the DragDropManager.GetUIElementParent method but I don't know how it could actually happen assuming the element that the DragSource is attached to is in the visual tree and I think it should be since the MouseLeftButtonDown event is firing which is what calls GetUIElementParent.
Speaking of the Infragistics DragDropManager, how are you using it in your app and how does it relate to the XamMultiColumnComboEditor? Based on the call stack it seems like an important part that my sample is missing so I'd like to try adding it in the same way it is used in your app.
version used is 16.1.20161.1000.