wpfdatagrid - Subclass binding in wpf to datagrid column -


i have class of following details:

public class contact         public prime contactprime end class public class contactprime         property conid string         property conname string         property company string         property jobtitle string         property contactno string         property addr string         property type string end class 

i have datagrid , item source set contactlist(of contact), question how can display prime.conname.

additional info: following current databinding in datagrid:

        <datagrid autogeneratecolumns="false" name="datagrid1" margin="0,10,0,0" height="500" width="695" horizontalscrollbarvisibility="auto" verticalscrollbarvisibility="visible" selectionmode="single" isreadonly="true" >             <datagrid.columns>                 <datagridtextcolumn binding="{binding conname}" header="name" width="150" />                 <datagridtextcolumn binding="{binding contactno}" header="numbers" width="150"/>                 <datagridtextcolumn binding="{binding addr}" header="address" width="150"/>                 <datagridtextcolumn binding="{binding type}" header="type" width="80"/>                 <datagridtextcolumn binding="{binding company}" header="company" width="70" />                 <datagridtextcolumn binding="{binding jobtitle}" header="job" width="70"/>             </datagrid.columns>         </datagrid> 

you can bind properties, not fields, ensure prime property of contact.

also, if wish ui notified of changes, should implement inotifypropertychanged on types.

if wish ui notified of collection changes contact list, should implement inotifycollectionchanged. observablecollection type provided wpf this.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -