1
我想向網格添加漸變背景和圓角。我有漸變,但我不能得到圓角工作。這將是一個狀態顯示彈出窗口,這是它背後的想法。還有更好的方法來設置漸變?向網格添加圓角
<UserControl x:Class="TestWPFStatusDisplay.StatusDisplayDialog"
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:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d"
d:DesignHeight="154" d:DesignWidth="391">
<Grid>
<Border Name="mask" Background="White" CornerRadius="7"/>
<Grid.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/>
</Grid.OpacityMask>
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#ECF5FF" Offset="0"/>
<GradientStop Color="#9CB0CA" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label HorizontalAlignment="Center" Grid.Row="0" Content="Words"/>
<Image Grid.Row="1" gif:ImageBehavior.AnimatedSource= "Images/GeoCartaLoading.gif" Width="125" Height="50" Margin="25,3,0,0"/>
<Label Grid.Row="2" Content="Words"/>
<ProgressBar Grid.Row="3" Name="pb" Maximum="60" />
</Grid>
把格邊框內,應用背景並將網格的背景設置爲透明或空白。 – Silvermind