wpf - Header inside itemscontrol -


i have table contains food types. each food type has 12 rows per person.

what need after selecting person, itemscontrol show 12 rows each food type.

i have been successful point, heading above each 12 rows stating food type, without repeating on each row.

does know way accomplish this?

my way far put headereditemscontrol inside itemscontrol. seems complicated way such simple issue.

thanks in advance help.

try:

xaml:

   <stackpanel grid.row="1">             <textblock text="{binding path=foodtypes[0].description}" />             <itemscontrol itemssource="{binding path=foodtypes}" >                 <itemscontrol.itemspanel>                     <itemspaneltemplate>                         <stackpanel />                     </itemspaneltemplate>                 </itemscontrol.itemspanel>                 <itemscontrol.itemtemplate>                     <datatemplate>                         <textblock margin="15,0,0,0" text="{binding path=text}" />                     </datatemplate>                 </itemscontrol.itemtemplate>             </itemscontrol>         </stackpanel> 

code:

public partial class mainwindow : window     {         public mainwindow()         {             initializecomponent();             this.datacontext = new myviewmodel();         }     }       public class foodtype     {         public string description {get;set;}         public string text {get;set;}     }      class myviewmodel : inotifypropertychanged     {         private observablecollection<foodtype> foodtypes;          public observablecollection<foodtype> foodtypes         {             { return this.foodtypes; }             set             {                 this.foodtypes = value;                 this.onpropertychanged("foodtypes");             }         }          public myviewmodel()         {             this.foodtypes = new observablecollection<foodtype>();              this.foodtypes.add(new foodtype() { description = "test1", text = "something" });             this.foodtypes.add(new foodtype() { description = "test1", text = "something else" });         }          public event propertychangedeventhandler propertychanged;          private void onpropertychanged(string propertyname)         {             var handler = this.propertychanged;             if(handler != null)             {                 handler(this, new propertychangedeventargs(propertyname));             }         }     } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -