How is it possible to render a element when its style or fill attribute is changed ? #183
Replies: 2 comments 4 replies
-
@pierreandreline Please I need some further information, how are you using this control? (have you extended it, how do you get the |
Beta Was this translation helpful? Give feedback.
-
I'm using SharpVectors lib v1.7.1 SvgPictureBox svg = new SvgPictureBox(); I add this instance to the WinForm and load a svg file with only on rectangle : this.Controls.Add(svg);
svg.Load(@"rect.svg"); Here's the rect.svg file content : <svg xmlns="http://www.w3.org/2000/svg">
<rect id="r" x="20" y="20" width="100" height="100" fill="#FF0000"/>
</svg> The rectangle is displayed correctly in red. On a button click, I try to change the fill color of then rectangle to green : SvgElement r = svg.Window.Document.GetElementById("r") as SvgElement;
r.SetAttribute("fill", "#00FF00"); The attribute change works but nothing changes on screen. Console.WriteLine(r.GetAttribute("fill")); // display "#00FF00" ok |
Beta Was this translation helpful? Give feedback.
-
In a SvgPictureBox, I need to dynamically change the colors of svg elements based on realtime data. For example :
But the change is not rendered in the SvgPictureBox instance.
Is there any other solution to change these attributes? or should I call a method to render after the change ? Thanks for any help
Beta Was this translation helpful? Give feedback.
All reactions