views:

71

answers:

1

Noob question. :)

I'm trying to add Margin to a Header through out my app and dont want to have to manually add that in all my views and I'll need to have various HeaderText. I know i need to add this to the App.xaml and i can get the Margin applied but I can't seem to get the Text to Bind.

My Header Looks like this currently:

                <c:PanoramaItem.Header>
                    <TextBlock Margin="50,0,0,0" Text="messages" />
                </c:PanoramaItem.Header>

I would like something like this:

<c:PanoramaItem HeaderTemplate="{StaticResource PanaramaHeaderTemplate}" Header="messages">

and in the App.xaml have something like this:

 <DataTemplate x:Key="PanaramaHeaderTemplate">
         <Grid Margin="50,0,0,0">
          <TextBlock TextWrapping="Wrap" Text="{TemplateBinding Header}"/>
         </Grid>
        </DataTemplate> 

But I dont get a header now.. I'm not sure if this is the right direction but i KNOW i dont want to have that property element syntax throughout my views.

Any help?

Thanks

A: 

I'm not familiar with PararamaHeader for phone, but I believe all you need to do is change your TextBlock in your DataTemplate to :

<TextBlock TextWrapping="Wrap" Text="{Binding}" />
Stephan