Let me try and state the simplest version of the question:
Can I have an UNBOUND dropdown-type column in my BOUND DataGrid?
Here is an example if the above statement is too abstract to understand:
A DataGrid named dgStudents that is bound to a DataTable named dtStudents, showing a few of the columns of the table, say Name, Age and City, all being simple DataGridTextColumns. I want to add a 4th column to my grid named say FavSports that is a simple dropdown type column, bound to a static list of common sports. The most important thing here is that (unlike other 3 columns) this dropdown column DOES NOT have a corresponding column in the DataTable. It'll just be required for the life of the DataGrid, so I'm not storing it anywhere.
I have tried the following:
<DataGridComboBoxColumn ItemsSource="{StaticResource Sports}">
where Sports is an array defined right within XAML:
<x:Array x:Key="Sports" Type="sys:String">
<sys:String>Football</sys:String>
<sys:String>Hockey</sys:String>
<sys:String>Tennis</sys:String>
</x:Array>
Can't get this to work for the life of me. The dropdown does display and user can select a value out of it that does show after user moves to another cell, but that's about it. After user comes back to that cell, the drop-down appears empty and even if user then leaves the cell without clicking the dropdown, the previous value is gone.
If you just want to bind to your
StaticResource, try this: