问题描述
我正在尝试修改PanoramaItem内容的大小,以使其没有边距,并拉伸整个屏幕的宽度/高度.到目前为止,我还没有尝试修改模板副本的运气.负边距可以左右,但是下一个全景项目总是从右边窥视,即使我设法拉伸了一个全景项目,下一个项目也会在屏幕的右侧重叠.
I'm trying to modify the PanoramaItem content size so that it has no margins and stretches the entire screen width/height. So far I've had no luck trying to modify a copy of the template. Negative margins can take care of the left/top but the next panorama item is always peeking from the right edge and even if I manage to stretch a panorama item the next one is overlapping in the right side of the screen.
任何想法如何修改全景图,以使实际的Panoramaitem占据整个屏幕(800x480),并且以下全景图项目始终与上一个Panoramaitem的左侧相距480px,这样您就看不到下一个项目的一部分
Any ideas how to modify the panorama so that the actual panoramaitem takes the whole screen (800x480) and the following panorama items are always 480px from the left side of the previous panoramaitem so that you can't see part of the next item.
为什么要修改全景图?因为该控件具有内置功能,可以执行我想做的所有事情(我正在构建一个支持轻拂手势的全屏图片查看器).我只希望Panoramaitem处于全屏状态,然后将图像放入整个容器尺寸(全屏)的内部
Why do I want to modify the panorama? Because the control has built-in functionality that does everything I want it to do (I'm building a full screen picture viewer with support for flick gesture). I would simply want the panoramaitem's to be full screen and then place images inside taking the entire size of the container (full screen)
全景建筑 http://msdn.microsoft.com/en -us/library/ff941126%28v = vs.92%29.aspx
推荐答案
C#
public class PanoramaFullScreen : Panorama
{
protected override System.Windows.Size MeasureOverride(System.Windows.Size availableSize)
{
availableSize.Width += 48;
return base.MeasureOverride(availableSize);
}
}
XAML
<Style x:Key="PanoramaItemStyle1" TargetType="phone:PanoramaItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:PanoramaItem">
<Grid Background="{TemplateBinding Background}" Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ContentControl x:Name="header" CharacterSpacing="-35" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" FontSize="66" FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Left" Margin="12,-2,0,38">
<ContentControl.RenderTransform>
<TranslateTransform x:Name="headerTransform"/>
</ContentControl.RenderTransform>
</ContentControl>
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
ItemContainerStyle="{StaticResource PanoramaItemStyle1}"
这篇关于如何将WP Panorama项目修改为全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!