GradientStop

Properties

  • stops : list<GradientStop>
    Detailed Description

A gradient is defined by two or more colors, which will be blended seamlessly.

The colors are specified as a set of GradientStop child items, each of which defines a position on the gradient from 0.0 to 1.0 and a color. The position of each GradientStop is defined by setting its position property; its color is defined using its color property.

A gradient without any gradient stops is rendered as a solid white fill.

Note that this item is not a visual representation of a gradient. To display a gradient, use a visual item (like Rectangle) which supports the use of gradients.

  • Example Usage

The following example declares a Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, and ending with green:

Rectangle {
    width: 100; height: 100
    gradient: Gradient {
        GradientStop { position: 0.0; color: "red" }
        GradientStop { position: 0.33; color: "yellow" }
        GradientStop { position: 1.0; color: "green" }
    }
}

  • Performance and Limitations

Calculating gradients can be computationally expensive compared to the use of solid color fills or images. Consider using gradients for static items in a user interface.

In Qt 5.0, only vertical, linear gradients can be applied to items. If you need to apply different orientations of gradients, a combination of rotation and clipping will need to be applied to the relevant items. This can introduce additional performance requirements for your application.

The use of animations involving gradient stops may not give the desired result. An alternative way to animate gradients is to use pre-generated images or SVG drawings containing gradients.

See also GradientStop.

Property Documentation

defaultstops : list<GradientStop>
This property holds the gradient stops describing the gradient.

By default, this property contains an empty list.

To set the gradient stops, define them as children of the Gradient.

时间: 2024-11-10 07:27:56

GradientStop的相关文章

win10 uwp 装机必备应用 含源代码

zhxilin大神说http://www.cnblogs.com/zhxilin/p/4819372.html这文章说到了使用await Windows.System.Launcher.LaunchUriAsync(new Uri(uri)); 打开应用商店 我想到了装机必备的一个软件 大概界面 求轻喷 我设计了MainPage.xaml拥有两个Frame 单例model 从https://www.microsoft.com/zh-cn/store/top-free/apps/pc得到软件图片

WPF 自定义控件 CropingImage 防QQ头像 编辑功能

1 <ControlTemplate x:Key="reSizeThumb" TargetType="{x:Type Thumb}"> 2 <Border Background="{DynamicResource BlueBrush}"> 3 </Border> 4 </ControlTemplate> 5 6 <ControlTemplate x:Key="moveThumb&qu

WPF ResourceDictionary的使用

作用:一个应用程序中,某个窗口需要使用样式,但是样式非常多,写在一个窗口中代码分类不方便.最好Style写在专门的xaml文件中,然后引用到窗口中,就像HTML引用外部css文件一样. 初衷:就在于可以实现多个项目之间的共享资源,资源字典只是一个简单的XAML文档,该文档除了存储希望使用的资源之外,不做任何其它的事情. 1.  创建资源字典 创建资源字典的过程比较简单,只是将需要使用的资源全都包含在一个xaml文件之中即可.如下面的例子(文件名test.xaml,与后面的app.xaml文件中的

WPF自定义样式篇-DataGrid

WPF自定义样式篇-DataGrid 先上效果图: 样式: <!--DataGrid样式-->    <Style TargetType="DataGrid">        <Setter Property="RowHeaderWidth" Value="0"></Setter>        <Setter Property="AutoGenerateColumns"

Windows Phone开发(10):常用控件(上)

Windows Phone的控件有几个来源,和传统的桌面应用程序开发或Web开发一样,有默认提供的控件和第三方开者发布的控件.一般而言,如果不是过于复杂的界面布局,使用默认控件就足矣.相比之下,Android SDK中尽管提供了许多可视化控件,但你会发现,实际开发用到的并不多,而且很多控件完全只是摆设,既没有公开相应的操作方法也没有更多可用于开发者自行处理的监听器(这里我习惯翻译为监听器,在安卓里面没有像C#那样使用事件,而是new一个监听器,当然原理是相似的). 除了游戏开外,我们在WP上基本

wpf 实现 css3 中 boxshadow inset 效果

using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; public class BoxShadow { public static Grid Create(Size size, Rect inner, GradientStopCollection sc) { Func

WPF CheckBox 样式

<Style x:Key="FocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static S

WPF 自定义模板 Button闪亮效果

Button的选中Effect,我们看下下面的效果: 让我们再放大一点: 怎么设置上面样式呢?直接设置Button的Effect,有点问题,因为Effect不是四周环绕的.那我们也只能重新定义Template了.下面看控件模板: <ControlTemplate x:Key="LightedBtnTemplate" TargetType="RadioButton"> <Grid> <Grid.RowDefinitions> <

ArcGIS API for Silverlight 加载google地图

原文:ArcGIS API for Silverlight 加载google地图 using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using Syst