【发布时间】:2016-04-21 13:42:51
【问题描述】:
您好,我设计了一个用作弹出窗口的用户控件,并且我已将用户控件背景属性设置为透明,但背景没有变得透明
我需要那个浅橙色是透明的
这是我的用户控件的 xaml 代码
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="WPFTest.UCToolTip"
mc:Ignorable="d" Height="231.493" Width="362.075"
Background="Transparent" >
<UserControl.Resources>
<Style TargetType="{x:Type Hyperlink}">
<Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
</Style>
</UserControl.Resources>
<Grid Margin="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Background="Orange" Margin="0,0,0,33">
<!--Your content here-->
</Grid>
<Polygon
Points="0,0 15,0, 0,30" Stroke="Orange" Fill="Orange" Margin="0,198,0,1" />
</Grid>
【问题讨论】:
-
背景颜色未在您包含在答案中的 XAML 中设置,它是由视觉树上方的另一个元素设置的
-
是的,它的用户控件大小,它不能进一步减小。如果将用户控件边框减小到网格大小,那么多边形将不可见,多边形以外的区域是该颜色:(
-
您需要从父控件中删除
Background="AntiqueWhite" -
我没有在任何地方设置它 ..??你从哪里询问删除?
-
在您的项目中搜索“AntiqueWhite”
标签: c# wpf xaml user-controls