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.
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.
Hopefully you'll be able to reproduce this. Having a sample would be very helpful as currently I have no idea why this exception is occurring for you. If I had at least a call stack I would know what method call was breaking and then dig around in the source code to make some guesses as to operation is invalid but currently I can't.
Disregard my last update, just saw you posted a call stack.