Questions tagged [solidcolorbrush]

18 questions
2
votes
2 answers

New Color from existing Color, making a renamed/copy/alias in xaml

I am attempting to follow the Don't Repeat Yourself principle i XAML, but I've reached a point where I'm struggling. I am defining colors for skinning. Say I have defined the colors I want to base my skin on: ...
Skod
  • 145
  • 1
  • 6
1
vote
1 answer

Custom SolidColorBrush too slow when drawing rectangles in WPF/C#

The following code effectively creates a 2D grid of rectangles, my issue is that when I use a custom SolidColorBrush the rendering becomes really slow. public partial class CalculatorView : UserControl { /// This is how I'm creating my custom…
fs_tigre
  • 9,459
  • 12
  • 53
  • 111
1
vote
1 answer

best way to change colors of a solidcolorbrush

I have a brush that is binded to the background of an element in my wpf app. When I initialize it in the constructor, I do so accordingly: MessageBackground = new SolidColorBrush(Colors.Red); Now there are times in the code where I want to change…
Jacob Alley
  • 646
  • 5
  • 23
1
vote
1 answer

Binding fails when using SolidColorBrush resource on Stroke property

I have created a UserControl and have quite a few bindings to several custom DependencyProperties in the control. For some reason though, one of these is failing with the error: System.Windows.Data Error: 4 : Cannot find source for binding with …
matthew_b
  • 615
  • 1
  • 6
  • 15
1
vote
0 answers

WPF SolidColorBrush color overlay (blending colors)

I am trying to find an easy way to change the color of an existing SolidColorBrush by adding a transparent overlay color. Is this possible without using shader effects, or putting a duplicate control on top with the overlay color? I have been told…
Peter Bulyaki
  • 149
  • 2
  • 10
1
vote
1 answer

SolidBrush.Clone throws exception

I'm using different types of brushes like SolidBrush, HatchBrush, etc.., to draw complex shapes and text in my windows forms control. The code I'm using is, protected void FillShape(Brush myBrush, GraphicsPath shape) { if…
Kira
  • 1,315
  • 13
  • 44
1
vote
2 answers

How to convert string to SolidColorBrush in C#?

I'm trying to convert a string to a SolidColorBrush in C#. The code I'm using is: arrColors[arrColors.Length - 1] = (SolidColorBrush)new BrushConverter().ConvertFromString(sLine); where sLine is a string read from a text…
Niels Bril
  • 21
  • 1
  • 4
1
vote
2 answers

How can I convert a hex Color value to its human-readable string representation?

I want to store a color hex value (such as "#FFFF1493") as its "human-friendly" name (such as "DeepPink"). With help from SLaks and nvoigt here, I've now got this code: if (sender is Canvas) { var canvas = sender as Canvas; var brush =…
B. Clay Shannon
  • 1,055
  • 124
  • 399
  • 759
1
vote
0 answers

How to extract color from a 3rd party SolidColorBrush resource

I have a DynamicResource called "resource" defined by a 3rd party. It references a SolidColorBrush and its color changes based on certain things. I need to create a color animation that starts with the current color of "resource" but I don't know…
Ignacio Soler Garcia
  • 20,097
  • 26
  • 114
  • 195
0
votes
0 answers

C# DirectX SolidColorBrush draws always Black

I am creating a SolidColorBrush and draw with it like that: public int CreateBrush(Color color) { if (color.A == 0) { color = Color.FromArgb(255, color); } _brushContainer.Add(new SolidColorBrush(_device, new RawColor4(color.R,…
0
votes
2 answers

How do I prevent memory leak from SolidColorBrush object?

There's no option to dispose SolidColorBrush. How do I prevent memory leak from SolidColorBrush object? I can't even use 'using' as SolidColorBrush doesn't implement IDisposable Interface.
0
votes
2 answers

C# SolidColorBrush to my Converter Class

i have an object of the type SolidColorBrush and it holds a SolidColorBrush. Now i have a converter for my dataGrid which is binded to a list. Each row in this dataGrid will be colored by the Converter i have. All is working fine, but how can i…
user6809531
0
votes
1 answer

How to use hex colour for SolidColorBrush with Windows Phone

I'm trying to use a hex colour (#E32017) programmatically for text within a textblock but it's not working. Does anyone know how a hex colour can used instead of Colors.Red when it comes to textblocks for Windows Phone? TextBlock textBlock = new…
SD826E
  • 6,673
  • 7
  • 45
  • 92
0
votes
1 answer

In Xaml, how do you change the value of the SolidColorBrush programmatically?

Hi I have a xaml app that has one particular color used in many places on a page. I want to programmatically change the value of this color. I don't want to have to update every object's color individually. I have tried this:
0
votes
1 answer

Trying to apply SolidColorBrush resource to HeaderedContentControl BorderBrush

I'd like to link a SolidColorBrush from my Window to Another SolidColorBrush in My dictionary. I didn't find something like this , and may be it's not possible ... here is the code in my "ResourceDictionary.xaml"
Stef G
  • 3
  • 3
1
2