Databinding still confues me and I am not sure how to essential make these controls repeat for each bound piece of data I have.
<Grid>
<TextBlock FontSize="25" Text="this is a header"></TextBlock>
<TextBlock Height="30" HorizontalAlignment="Left" Margin="19,36,0,0" Name="txt" Text="line under the header" VerticalAlignment="Top" />
<TextBlock Height="30" FontSize="25" HorizontalAlignment="Left" Margin="306,9,0,0" Name="textBlock2" Text="530" VerticalAlignment="Top" Width="91" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="305,42,0,0" Name="textBlock3" Text="30" VerticalAlignment="Top" Width="91" />
</Grid>

If my data source would have a count of 50. I would expect to see 50 of these groupings(I probably need to get a scroll bar though).
Not sure how to do this though. I need some sort of datatemplate I guess? Also “line under the header” should be clickable and highlight.
I think you need to use the control named “ItemsControl”. Not a derived class, not a ListBox, just plain simple
ItemsControl.Either in code or in XAML, you set the ItemsControl’s
ItemsSourceproperty to any collection containing your items.In XAML (either in VS or Blend, to do it WYSIWYG in Blend you must somehow provide design data) you set the ItemsControl’s
ItemTemplateto aDataTemplatethat contains the XAML subtree you want to repeat for every item in your collection.Inside the
DataTemplate, replace “line under the header” with the Button control, withContent="line under the header", and style it however you want. Then, addCallMethodActionto your button. It only takes 2 clicks in Blend, the first one is on “Assets” window. SpecifyTargetObject="{Binding}" MethodName="actSubtitleClicked". This way, the framework will call thevoid actSubtitleClicked()method of the item where user clicked the “line under the header”.For best performance, you should also modify the ItemsControl’s ItemsPanel template, replacing StackPanel with VirtualizingStackPanel (again, a few clicks in Blend, the first one is the right click, then “Edit additional templates / ItemsPanel / Edit a copy”)