2010-10-16 6 views
1

Je travaille sur une application WP7. Eh bien sur l'une des pages, je voudrais avoir un point d'interrogation disponible pour les utilisateurs à sélectionner. Le seul problème que j'ai est de le garder dans un endroit précis. Si l'immobilier est disponible, je veux qu'il soit tout le temps dans le coin inférieur droit. Mais si l'utilisateur doit faire défiler, je veux que l'on doive également faire défiler cet élément.Définir dans Silverlight une image à un emplacement spécifique

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 
    .... 
    <StackPanel Grid.Row="1"> 
     <Image Source="/Images/question_mark.png" Stretch="None" 
      VerticalAlignment="Bottom" HorizontalAlignment="Right" /> 
    </StackPanel> 
</Grid> 

Alors, comment puis-je conserver une image/bouton au bas de la page? Ai-je besoin de changer quelque chose pour que ce soit toujours en bas si l'utilisateur a besoin de faire défiler? J'apprécie ton aide!

Répondre

0

Il semble que vous vouliez que l'image soit au bas du contenu défilant. Pour ce faire, placez un StackPanel à l'intérieur d'un ScrollViewer

<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <!--TitlePanel contains the name of the application and page title--> 
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
     <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/> 
     <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> 
    </StackPanel> 

    <!--ContentPanel - place additional content here--> 
    <ScrollViewer x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
     <StackPanel> 
      <Rectangle Height="400" Fill="Brown" /> 
      <Rectangle Height="400" Fill="Green" /> 
      <Image Source="/Images/question_mark.png" Stretch="None" 
       VerticalAlignment="Bottom" HorizontalAlignment="Right" /> 
     </StackPanel> 
    </ScrollViewer> 
</Grid> 
Questions connexes