您必须更改控件的模板,因为在那里设置了弹出窗口的背景。
默认 DropDownButton 控件模板:
<ControlTemplate x:Key="DefaultDropDownTemplate" TargetType="xctk:DropDownButton">
<Grid Name="MainGrid" SnapsToDevicePixels="True">
<ToggleButton Grid.Column="1" IsChecked="{Binding Path=IsOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Name="PART_DropDownButton">
<ToggleButton.IsHitTestVisible>
<Binding Path="IsOpen" RelativeSource="{RelativeSource TemplatedParent}">
<Binding.Converter>
<xctk:InverseBoolConverter />
</Binding.Converter>
</Binding>
</ToggleButton.IsHitTestVisible>
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" />
</ControlTemplate>
</ToggleButton.Template>
<Grid>
<xctk:ButtonChrome CornerRadius="2.75" InnerCornerRadius="1.75" Name="ToggleButtonChrome" RenderChecked="{TemplateBinding xctk:DropDownButton.IsOpen}" RenderEnabled="{TemplateBinding UIElement.IsEnabled}" RenderMouseOver="{Binding Path=IsMouseOver, ElementName=PART_DropDownButton}" RenderPressed="{Binding Path=IsPressed, ElementName=PART_DropDownButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" Margin="{TemplateBinding Control.Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
<Grid Grid.Column="1" IsHitTestVisible="False" Margin="4,3" Name="arrowGlyph">
<Path Data="M0,1C0,1 0,0 0,0 0,0 3,0 3,0 3,0 3,1 3,1 3,1 4,1 4,1 4,1 4,0 4,0 4,0 7,0 7,0 7,0 7,1 7,1 7,1 6,1 6,1 6,1 6,2 6,2 6,2 5,2 5,2 5,2 5,3 5,3 5,3 4,3 4,3 4,3 4,4 4,4 4,4 3,4 3,4 3,4 3,3 3,3 3,3 2,3 2,3 2,3 2,2 2,2 2,2 1,2 1,2 1,2 1,1 1,1 1,1 0,1 0,1z" Fill="Black" Height="4" Name="Arrow" Width="7" />
</Grid>
</Grid>
</xctk:ButtonChrome>
</Grid>
</ToggleButton>
<Popup AllowsTransparency="True" Focusable="False" HorizontalOffset="1" IsOpen="{Binding Path=IsChecked, ElementName=PART_DropDownButton}" Name="PART_Popup" Placement="Bottom" StaysOpen="False" VerticalOffset="1">
<Border BorderThickness="1">
<Border.Background>
该背景颜色的设置器的开始:
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FFE8EBED" Offset="1" />
</LinearGradientBrush>
该背景颜色的设置器的结尾:
</Border.Background>
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0" />
<GradientStop Color="#FF8399A9" Offset="0.375" />
<GradientStop Color="#FF718597" Offset="0.375" />
<GradientStop Color="#FF617584" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<ContentPresenter Content="{TemplateBinding xctk:DropDownButton.DropDownContent}" Name="PART_ContentPresenter" />
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsEnabled" Value="False">
<Setter Property="Shape.Fill" TargetName="Arrow" Value="#FFAFAFAF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
在控件模板中更改此画笔的“不透明度”以更改其透明度。
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0" Opacity="0.5">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FFE8EBED" Offset="1" />
</LinearGradientBrush>