Questions tagged [lineargradientbrush]

76 questions
14
votes
3 answers

Get color in specific location on gradient

I have the following GradientStopCollection: GradientStopCollection grsc = new GradientStopCollection(3); grsc.Add(new GradientStop(Colors.Red, 0)); grsc.Add(new GradientStop(Colors.Yellow, .5)); grsc.Add(new GradientStop(Colors.Green, 1)); Can I…
Matan Shahar
  • 3,190
  • 2
  • 20
  • 45
11
votes
3 answers

How to use LinearGradientBrush and Background

I'm trying to paint a background of my WPF window using LinearGradientBrush, however my code doesn't work. Here is the code LinearGradientBrush gradientBrush = new LinearGradientBrush( Color.FromArgb(0, 209, 227, 250), Color.FromArgb(0, 170, 199,…
wpflerner
  • 111
  • 1
  • 1
  • 3
7
votes
2 answers

Fill Panel with gradient in three colors

I'm working on project and I have to do kind of color picker using C#. So I've decided that it will be a Panel with this background in Win Forms App. Background should have gradient with three colors in rgb: red (0 - 255), blue (0 - 255) and green…
Buga1234
  • 151
  • 1
  • 3
  • 11
7
votes
2 answers

Set button background style in wpf

i have one button and i set button background style with LinearGradientBrush. everything works fine but when i run button and press click on button then gradient color is showing ob button with bit of animation but i have not write anything for…
Thomas
  • 33,544
  • 126
  • 357
  • 626
6
votes
2 answers

Linear Gradient from bottom to top

I need an Ellipse with a linear gradient from bottom(pink) to top(red).
Ranjith Venkatesh
  • 1,322
  • 3
  • 20
  • 57
6
votes
1 answer

How to read the color from an offset of a XAML LinearGradientBrush?

Given a LinearGradientBrush defined as follows:
Rob Perkins
  • 3,088
  • 1
  • 30
  • 51
5
votes
1 answer

Apply Opacity to LinearGradientBrush

I have a LinearGradientBrush defined as follows. I want to use this somewhere in my xaml but I want to change the opacity in this particular case (only in this instance, not everywhere I use it). Any ideas how to accomplish this? …
KrisTrip
  • 4,943
  • 12
  • 55
  • 74
4
votes
5 answers

Dynamic Gradient Background based on int value

for an order overview I have a list of multiple orders with different priorities. They reach from -10 => very high priority to +20 => low priority. Based on this priority I want to return a Gradient brush Color dynamically. For example: From -10 to…
Johannes Wanzek
  • 2,825
  • 2
  • 29
  • 47
4
votes
1 answer

Animate a linear brush using a data trigger

I am trying to animate a linear brush on a border using a data trigger but have come accross a problem where I cannot use the TargetName My code is as follows, can anyone suggest a way to resolve this?
Kezza
  • 736
  • 9
  • 25
3
votes
1 answer

Setting a LinearGradientBrush instead of a solid color to a storyboard.targetProperty in a VisualState

I'm wondering how I can set a Storyboard.TargetProperty to a LinearGradientBrush instead of a solid color. I'm new to VisualStates so please let me know if I'm not given enough information for my question. Mostly I just want to set a Gradient…
Terco
  • 920
  • 3
  • 19
  • 34
3
votes
2 answers

LinearGradientBrush with a fixed-width gradient on both ends

I want to use a LinearGradientBrush to fill a rectangular range on a canvas with a gradient. The catch is, I want the gradient to appear the same on both sides of the rectangle, no matter how large the rectangle is. What I'm trying to draw is…
Ed Beaty
  • 415
  • 1
  • 6
  • 14
3
votes
2 answers

SVG -> WPF linear gradient

Does anyone know if there is an equilant attribute of SVG's "gradientUnits=userSpaceOnUse" in WPF for a LinearGradientBrush? I can't seem to find this. If not, does anyone know about how to calculate it in (C# or VB.NET)? For example if I have a…
Todd Main
  • 28,951
  • 11
  • 82
  • 146
3
votes
0 answers

c# GDI+ out of memory exception

Intro: Lets' set of points (x, y) on a plane and func F(x, y) returning double. Points're generated randomly in the user-defined rectangle(which means constraint on variables). Let's set the number of gerated points as N. This set than is…
pkuderov
  • 3,501
  • 2
  • 28
  • 46
3
votes
1 answer

LinearGradientBrush Color Binding (Simple Bar Chart ItemsControl)

EDIT: I had hex value(string) that i converted to a Brush hence it did not take my color the following like takes my colors succesfully: (Color)ColorConverter.ConvertFromString(colorArray[0]) The only problem remaining is the scaling (with colors).…
PeterP
  • 741
  • 1
  • 8
  • 20
2
votes
1 answer

Problem with Multigradient brush implementation from scatch in C++ and GDI

I am trying to implement a gradient brush from scratch in C++ with GDI. I don't want to use GDI+ or any other graphics framework. I want the gradient to be of any direction (arbitrary angle). My algorithm in pseudocode: For each pixel in x…
George Eracleous
  • 4,278
  • 6
  • 41
  • 50
1
2 3 4 5 6