2010-09-22 41 views
5

Xin vui lòng bất cứ ai cho tôi biết làm thế nào để thiết lập hình ảnh trong nền bảng xếp chồng trong xaml? Tôi đã cố gắng sau đó ném một lỗi mà Background không có tài sản ImageLàm thế nào để thiết lập nền trong 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> 

Trả lời

12

Hãy thử điều này

<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> 
Các vấn đề liên quan