I already bind a listview (grid) with hashtable, so how can I get items from there? Before using hashtable I just did ListViewA.SelectedItems;
and I was getting the source.
Ir fails when I use two foreach
loops:
dlstTemplates
is my ListView in WPF
foreach (var group in dlstTemplates.SelectedItems)
{
foreach (var Template in group)
{
}
}
Error 2 foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator' D:\cs_InformeMedico\app\Template.xaml.cs 85 21 Demo.View
I found this on debugger:
- dlstPlantillas.SelectedItems Count = 1 System.Collections.IList {System.Windows.Controls.SelectedItemCollection}
- [0] {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>} object {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>}
- Non-Public members
+ items Count = 97 System.Collections.Generic.IEnumerable<Demo.View.Plantilla> {System.Collections.Generic.List<Demo.View.Plantilla>}
key "101010112000" string
System.Linq.IGrouping<K,T>.Key "101010112000" string
- Results View Expanding the Results View will enumerate the IEnumerable
+ [0] {Demo.View.Plantilla} Demo.View.Plantilla
+ [1] {Demo.View.Plantilla} Demo.View.Plantilla
+ [2] {Demo.View.Plantilla} Demo.View.Plantilla
+ [3] {Demo.View.Plantilla} Demo.View.Plantilla
+ [4] {Demo.View.Plantilla} Demo.View.Plantilla
+ [5] {Demo.View.Plantilla} Demo.View.Plantilla
+ [6] {Demo.View.Plantilla} Demo.View.Plantilla
+ [7] {Demo.View.Plantilla} Demo.View.Plantilla
+ [8] {Demo.View.Plantilla} Demo.View.Plantilla
+ [9] {Demo.View.Plantilla} Demo.View.Plantilla
+ [10] {Demo.View.Plantilla} Demo.View.Plantilla
- Raw View
- [System.Windows.Controls.SelectedItemCollection] Count = 1 System.Windows.Controls.SelectedItemCollection
+ [0] {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>} object {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>}
+ Raw View
IsFixedSize false bool
IsReadOnly false bool
So when group is a
{System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>} object type
Sorry Plantilla = Template, I traduce it for more understand