I’m trying to convert a Winforms app to a WPF app and have this code:
ObservableCollection<Dictionary<string, string>> PlatypusDict =
new ObservableCollection<Dictionary<string, string>>();
. . .
PlatypusDict = PlatypusData.getPlatypusAccountsForCentury(Convert.ToInt32(labelPlatypusName.Tag));
…which gives me this err msg:
Cannot implicitly convert type ‘System.Collections.Generic.Dictionary’ to ‘System.Collections.ObjectModel.ObservableCollection>’
…and this doesn’t help any:
PlatypusDict = (System.Collections.ObjectModel.ObservableCollection<System.Collections.Generic.Dictionary<string, string>>)PlatypusData.getPlatypusAccountsForCentury(Convert.ToInt32(labelPlatypusName.Tag));
Do I not really need to use an ObservableCollection to bind my ListView to, or what is the workaround/proper methodology here?
You can just binding Dictionary to ListView.
Example:
XAML file:
Code-behind file: