Je veux cacher le titre <controls:Panorama Title="myTitle" Style="{StaticResource customStyle}">
en mode paysagePanorama Hiding Titre en mode paysage [wp7]
J'ai appliqué un style personnalisé pour elle (code ci-dessous) et d'essayer de le faire (basé sur le nom dans le style personnalisé), mais je reçois erreur le nom TitleLayer n'existe pas dans le contexte actuel:
if ((e.Orientation == PageOrientation.LandscapeRight) || (e.Orientation == PageOrientation.LandscapeLeft))
{
TitleLayer.Visibility = Visibility.Collapsed;
}
///////////////// code supplémentaire pour la recherche //// ///////////////////
Pour cela, j'ont appliqué un style personnalisé:
<phone:PhoneApplicationPage.Resources>
<Style x:Key="customStyle" TargetType="controls:Panorama">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<controlsPrimitives:PanoramaPanel x:Name="panel"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Panorama">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<controlsPrimitives:PanningBackgroundLayer x:Name="BackgroundLayer" HorizontalAlignment="Left" Grid.RowSpan="2">
<Border x:Name="background" Background="{TemplateBinding Background}" CacheMode="BitmapCache"/>
</controlsPrimitives:PanningBackgroundLayer>
<controlsPrimitives:PanningTitleLayer x:Name="TitleLayer" CacheMode="BitmapCache" ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" FontSize="187" FontFamily="{StaticResource PhoneFontFamilyLight}" HorizontalAlignment="Left" Margin="10,-76,0,9" Grid.Row="0"/>
<controlsPrimitives:PanningLayer x:Name="ItemsLayer" HorizontalAlignment="Left" Grid.Row="1">
<ItemsPresenter x:Name="items"/>
</controlsPrimitives:PanningLayer>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
La commande panoramique n'est pas conçue pour être utilisée en mode paysage. Quelle est votre raison de vouloir le faire? –
@Matt Flexibilité, même si mon application est la mieux adaptée pour le portrait, mais en tant que développeur, je devrais également honorer les appareils avec clavier coulissant paysage. – Shishant