2010-09-22 18 views
5

S'il vous plaît quelqu'un peut-il me faire savoir comment définir l'image dans l'arrière-plan du panneau de pile dans xaml? Je l'ai déjà essayé ce qui suit, il lancer une erreur Background n'a pas la propriété ImageComment faire pour définir l'arrière-plan dans StackPanel

<Button.ToolTip> 
     <StackPanel Height="200" Width="200"> 
      <StackPanel Height="30" Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" > 
       <StackPanel.Background> 
        <Image Source="E:\R\watermark9.bmp"></Image> 
       </StackPanel.Background> 
       <Image VerticalAlignment="Top" Width="30" Height="30" Source="E:\My Projects\Interconnect_New\Interconnect\Resources\watermark9.bmp" Name="image1" /> 
       <TextBlock FontFamily="Aharoni" FontSize="24" FontWeight="Bold" Foreground="Black" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="143"> 
        <Run FontFamily="Andalus" FontSize="18" FontWeight="Normal" Text="Hello! Fancy Tip" /> 
       </TextBlock> 
      </StackPanel> 
      </StackPanel> 
    </Button.ToolTip> 

Répondre

12

Essayez cette

<Button.ToolTip> 
    <StackPanel Height="200" Width="200"> 
     <StackPanel Height="30" Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" > 
      <StackPanel.Background> 
       <ImageBrush ImageSource="E:\R\watermark9.bmp" /> 
      </StackPanel.Background> 
      <Image VerticalAlignment="Top" Width="30" Height="30" Source="E:\My Projects\Interconnect_New\Interconnect\Resources\watermark9.bmp" Name="image1" /> 
      <TextBlock FontFamily="Aharoni" FontSize="24" FontWeight="Bold" Foreground="Black" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="143">     <Run FontFamily="Andalus" FontSize="18" FontWeight="Normal" Text="Hello! Fancy Tip" /></TextBlock> 
     </StackPanel> 
    </StackPanel> 
</Button.ToolTip>