c# - WCF To WPF client - Populating the ListBox -


that method populating listbox data comes wcf service.

private void filllistbox()         {             servicereference1.service1client client = new servicereference1.service1client();             client.open();             listbox.itemssource = client.getallproducts();                     } 

but in listbox can see

productlistclient.servicereference1.product 

therefore have added override tostring() method in model, still can not see data in listbox. how can fix that?

it seems binding working , list contain items. need implement itemdatatemplate in listbox this:

<listbox width="400" margin="10"          itemssource="{binding source={staticresource mytodolist}}">    <listbox.itemtemplate>      <datatemplate>        <stackpanel>          <textblock text="{binding path=taskname}" />          <textblock text="{binding path=description}"/>          <textblock text="{binding path=priority}"/>        </stackpanel>      </datatemplate>    </listbox.itemtemplate>  </listbox> 

ignore naming of example. need adapt names of objects in application


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -