2016-04-11 80 views
0

我正在使用擴展器控件來創建用戶控件。我想爲擴展器控件設置漸變背景。如何爲擴展器控件設置漸變背景?如何爲擴展器控件設置漸變背景wpf

+1

你應該表現出一些代碼來獲取答案在這裏。 – Nitin

+0

試試這個鏈接1)http://prntscr.com/aqtq5g和2)youtube.com/watch?v=TZMUF6KYW18 –

回答

0

參見本: - http://www.c-sharpcorner.com/uploadfile/prathore/wpf-lineargradientbrush-using-xaml/

<Border Margin="10,10,10,10" BorderBrush="Red" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8"> 
    <Border.Background> 
     <LinearGradientBrush EndPoint="0.504,1.5" StartPoint="0.504,0.03"> 
      <GradientStop Color="#FFFFC934" Offset="0"/> 
      <GradientStop Color="#FFFFFFFF" Offset="0.567"/> 
     </LinearGradientBrush> 
    </Border.Background> 

    <DockPanel> 
     <StackPanel Width="Auto" Height="235" DockPanel.Dock="Top" Orientation="Horizontal" VerticalAlignment="Top"> 

      <StackPanel Margin="15,20,15,20"> 
       <Border BorderBrush="White" BorderThickness="4" Width="108" Height="88"> 
        <Image Source="cat.jpg" Height="80" Width="100" Stretch="Fill"></Image> 
       </Border> 
      </StackPanel> 

      <StackPanel Margin="0,20,0,20"> 
       <Label Content="Purushottam Rathore" FontSize="15" Foreground="Navy" /> 
       <Label Content="India" FontSize="15" Foreground="Navy"/> 
      </StackPanel> 
     </StackPanel> 
    </DockPanel> 
</Border>