WPF透明度
我使用带有 DataTemplate 的列表框来创建下面的地图图例。我想让 ListBox 具有透明背景(现在是白色),并且 ListItems 保留其现有的白色背景。然后,两个图例就会悬浮在空中,中间有一个透明的间隙。
我尝试将 ListBox 背景设置为 SolidBrush,不透明度设置为 0,但这似乎不起作用。我知道树中的项目的透明度不能低于树中上面的项目。这是我的问题吗?我该如何解决?
谢谢
I am using a ListBox with a DataTemplate to create the below map legend. I would like to get the ListBox to have a transparent background (where it is now white) and the ListItems to retain their existing white background. The two legends would then appear to float with a transparent gap between.
I have tried setting the ListBox background with a SolidBrush set to 0 opacity but that doesn't seem to work. I understand that items in the tree cannot have transparency that is less than items above in the tree. Is that my issue and how do I resolve?
Thanks
alt text http://www.freeimagehosting.net/uploads/659cd194e7.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将背景设置为 {x:Null}。
You can set the Background to {x:Null}.
您是否尝试将列表框的背景颜色设置为“透明”(字面意思)?
这是一些对我有用的代码:
Did you try setting the background color of the ListBox to "Transparent" (literally)?
Here is some code that worked for me: