如何在StackPanel中设置背景
请任何人告诉我如何在 xaml 中的堆栈面板背景中设置图像?我已经尝试过以下操作,它引发了 Background
没有属性 Image
的错误
<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>
Please anyone let me know how to set image in stack panel background in xaml ? I have already tried the following it throwing an error that Background
does not have property Image
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
Try this
您需要使用图像画笔
You need to use an image brush