generate Grid from template
- by theXs
Howdy,
I've got another question regarding phone 7... I want to generate a couple of Grids in a stackpanel - since they all have the same layout I thought it would be a great idea to use DataTemplates ...
But then I found that the GRID Object has no "DataTemplate" Property and now I'm kinda stuck ... the template which I use is the following:
<DataTemplate x:Key="Speise">
<Grid>
<TextBlock Height="36" Margin="8,43,104,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Right" Height="36" Margin="0,44,8,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="92"/>
</Grid>
</DataTemplate>
The way I now thought of creating my objects is:
Grid blubber = (Grid)this.Resources["Speise"];
But that is not working ... I think it's again a really short thing, but I have no clue of how to google for it :(