c# - How to bind each GridViewColumn to a separate ObservableCollection? -


firstly using listview control itself:

itemssource="{binding alleffects}" 

so not allow individual binding per gridviewcolumn?

besides alleffects have 2 other observablecollection want bind 2 other gridviewcolumn:

public observablecollection<gpusupportnode> gpusupport { get; set; } public observablecollection<cpusupportnode> cpusupport { get; set; }  public class cpusupportnode {     public bool issupported {get;set;} } 

i trying hook these 2 gridviewcolumns gpusupport/cpusupport .issupported respectively.

right have:

<gridviewcolumn     width="auto"     header="gpu">     <gridviewcolumn.celltemplate>         <datatemplate>             <checkbox                 margin="0"                 horizontalalignment="center"                 ischecked="{binding gpusupport, mode=twoway}"/>         </datatemplate>     </gridviewcolumn.celltemplate> </gridviewcolumn> 

but doesn't work. possible?

you can try creating viewmodel class this

public class myviewmodel {   public observablecollection<gpusupportnode> gpusupport { get; set; }  public observablecollection<cpusupportnode> cpusupport { get; set; }  public observablecollection<typeofeffects> alleffects{ get; set; }  } 

and create instance of myviewmodel, viewmodel , initialize observable collections. set itemssource

itemssource="{binding viewmodel}"   

and should work.

<gridviewcolumn     width="auto"     header="gpu">     <gridviewcolumn.celltemplate>         <datatemplate>             <checkbox                 margin="0"                 horizontalalignment="center"                 ischecked="{binding gpusupport, mode=twoway}"/>         </datatemplate>     </gridviewcolumn.celltemplate> </gridviewcolumn> 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -