I have a ARGB color code and now I'm trying to set selectedcolor of ColorCanvas by using that ARGB color code in codebehind. Argb color code is not static value since it'll kept changing. Can anyone know how to set it?I have tried to do like this but it's not working:
rec.Fill = new SolidColorBrush(Color.FromArgb(a, r, g, b));
Not sure why it looks like you are using the
Fill
property of aRectangle
and not showing aColorCanvas
, but theColorCanvas.SelectedColor
is a Color not a Brush. So something like this should work(My ColorCanvas has x:Name of colorCanvas).if you are trying to get the color from a
SolidColorBrush
like the Fill Property of a Rectangle(Providing it is a SolidColorBrush), something like this should work.If neither of these example is what you are asking please clarify your question, add more code that you have tried plus any and all errors that you may be getting.