开发者

Binding A Value in Header WP7/Silverlight

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开发者_JS百科 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


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}" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜