Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Filling combobox with observable list which consumed from wcf service

$
0
0
i am Beginner in WPF.i am trying to fill combobox with observable collection which is retrieved from wcf service

xaml code:
<ComboBox x:Name="cmbclass" ItemsSource="{Binding ClassList}" VerticalAlignment="Top" DisplayMemberPath="ClassName" SelectedValuePath="ClassID"/>

Consuming service:

ServiceReference1.Service1Client ClassList = new ServiceReference1.Service1Client();

ObservableCollection<ClassDO> Classlist = new ObservableCollection<ClassDO>();


Classlist = ClassList.GetClassList();
cmbclass.ItemsSource = Classlist;
cmbclass.DisplayMemberPath = "ClassID";
cmbclass.SelectedValuePath = "CLassName";

i am getting following error can anyone please help me

Cannot implicitly convert type 'SchoolManagementSystem.ServiceReference1.ClassDO[]' to 'System.Collections.ObjectModel.ObservableCollection<SchoolManagementSystem.ServiceReference1.ClassDO>' D:\Dotnet\Projects\WPF\WindowsPhoneApps\SchoolManagementSystem\SchoolManagementSystem\MainWindow.xaml.cs 37 25 SchoolManagementSystem

Thanks in advance

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>