我在 WPF(C#) 中编程。我正在尝试定义一些东西来改变程序的皮肤。
我使用这段代码:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="RFID.OperationWindow" Title="OperationWindow" Height="768" Width="1366" ResizeMode="CanResize" WindowStyle="None" WindowStartupLocation="CenterScreen" WindowState="Maximized">
<Window.Resources>
<LinearGradientBrush x:Key="AquaGradient" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF6F6F6" Offset="1"/>
<GradientStop Color="#FFEAE8E8" Offset="1"/>
<GradientStop Color="#FFDCD9D9" Offset="1"/>
<GradientStop Color="#FF46AFBF" Offset="0.5"/>
<GradientStop Color="#FFE0DDDD"/>
<GradientStop Color="#FF4EDAF0" Offset="0.018"/>
<GradientStop Color="#FF75C2BF" Offset="0.964"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="GreenGradient" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.082"/>
<GradientStop Color="#FFDDDDDD" Offset="0.071"/>
<GradientStop Color="#FF0FFB2F" Offset="1"/>
</LinearGradientBrush>
<Window.Resources>
如何将 LinearGradientBrush 分配给控件背景?像这样的东西:
我AquaGradient
用于控件的每个背景。如何GreenGradient
动态分配给所有背景?
例如这样的事情:
AquaGradient = GreenGradient;