gpt4 book ai didi

windows-phone-7 - 如何为枢轴项目标题添加图像

转载 作者:行者123 更新时间:2023-12-04 06:58:31 24 4
gpt4 key购买 nike

正在开发一个简单的应用程序,用于在 wp7 中学习 pivot control

我们可以为数据透视项目添加图像而不是标题中的文本(下图中的红色标记区域)。

是否可以添加图片,请建议我

我的 xaml 代码是:

 <Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="MY APPLICATION" Name="mainPivot">
<!--Pivot item one-->
<controls:PivotItem Header="item1">
<Grid>
<Image Source="/SchoolList;component/Gallery/child.jpg"/>
</Grid>
</controls:PivotItem>

<!--Pivot item two-->
<controls:PivotItem Header="item2">
<Grid>
<Image Source="/SchoolList;component/Gallery/class.jpg"/>
</Grid>
</controls:PivotItem>
</controls:Pivot>
</Grid>

提前致谢

in marked red area can we add images

最佳答案

使用这个提示:

<phone:Pivot>
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<Image Source="{Binding}" /> // important
</DataTemplate>
</phone:Pivot.HeaderTemplate>
</phone:Pivot>

然后将您的 Pivot Item 标题设置为

<phone:PivotItem Header="path-to-image" >

check the screen shot

关于windows-phone-7 - 如何为枢轴项目标题添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14440619/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com