Hey,
I got a simple problem. I Tried to bind to the:
SelectedDataItemsScope="RecordsOnly" SelectedDataItems="{Binding SelectedChildMessages, Mode=TwoWay}"
But it does not seem to load any Items into the Collection when i selected (by Using Shift OR Ctrl and mouse) into the collection that is bound in the ViewModel.
Version: 16.1
Kind Regards Jean-Pierre Bachmann on behalf of Plan-International
Hello Jean-Pierre,
Thank you for the code-snippet you have provided.
The SelectedDataItems property of the XamDataGrid is of type - object array (object[]). A binding between this property and a collection will not result in a success.I can suggest you create a property of type object[] as well inside the ViewModel class and bind to it.
XAML:
<igDP:XamDataGrid Name="XDT" DataSource="{Binding Path=Items}" SelectedDataItems="{Binding Path=MySelectedDataItems, Mode=TwoWay}" SelectedDataItemsScope="RecordsOnly"/>
Code-behind:
public class ViewModel{ public object[] MySelectedDataItems { get; set; }}
In order to bind a collection to the SelectedDataItems, the best approach would be to use a converter for the binding, which will allow us to transfer the items from the array to a newly created collection.
I have attached a sample application that demonstrates the initial approach from above.
If you have any questions, please let me know.