1
我想为Windows Phone平台上的Panorama设置背景。背景应该是单独的布局或UI元素,而不是静态的JPEG或PNG图像。我怎样才能做到这一点? 谢谢。布局作为Panorama的背景
我想为Windows Phone平台上的Panorama设置背景。背景应该是单独的布局或UI元素,而不是静态的JPEG或PNG图像。我怎样才能做到这一点? 谢谢。布局作为Panorama的背景
所以这其实是可以通过重写全景的声像层(控制的秘密武器视差效果):
<phone:Panorama>
<phone:Panorama.Template>
<ControlTemplate TargetType="phone:Panorama">
<Grid x:Name="TemplateGrid"
Background="Transparent"
Loaded="TemplateGrid_OnLoaded">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<controlsPrimitives:PanningBackgroundLayer
x:Name="BackgroundLayer"
Grid.RowSpan="2"
HorizontalAlignment="Left">
<!-- Whatever UI elements you like -->
</controlsPrimitives:PanningBackgroundLayer>
<controlsPrimitives:PanningTitleLayer x:Name="TitleLayer"
Grid.Row="0"
HorizontalAlignment="Left"
CacheMode="BitmapCache"
Content="{TemplateBinding Title}"
ContentTemplate="{TemplateBinding TitleTemplate}"/>
<controlsPrimitives:PanningLayer x:Name="ItemsLayer"
Grid.Row="1"
HorizontalAlignment="Left">
<ItemsPresenter x:Name="items" />
</controlsPrimitives:PanningLayer>
</Grid>
</ControlTemplate>
</phone:Panorama.Template>
</Panorama>
我建议你谨慎跟你放什么在背景层。形状和图像是好的,但按钮和其他这样的输入控件将能够接受点击和点击,这对用户来说会很奇怪。
你不能这样做,它必须是一个图像! –