<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with JavaScript</title><link>http://forums.silverlight.net/forums/16.aspx</link><description>Discussions about programming Silverlight with JavaScript</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/18332.aspx</link><pubDate>Tue, 23 Oct 2007 13:42:12 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:18332</guid><dc:creator>kp2712</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/18332.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=18332</wfw:commentRss><description>&lt;p&gt;Hi,I want to do something similar..I want to&amp;nbsp;obtain the background of a canvas(which is a LinearGradientBrush) and assign it to a rectagle&amp;#39;s fill property.Can you tell me how to do it?&lt;/p&gt;</description></item><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/16673.aspx</link><pubDate>Fri, 05 Oct 2007 16:50:29 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:16673</guid><dc:creator>TBink</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/16673.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=16673</wfw:commentRss><description>&lt;p&gt;Many thanks... this is just what I was looking for!&lt;/p&gt;</description></item><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/16600.aspx</link><pubDate>Fri, 05 Oct 2007 06:16:25 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:16600</guid><dc:creator>suyog kale</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/16600.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=16600</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;its simple&lt;/p&gt;&lt;p&gt;var vobj=document.getElementById(&amp;quot;YourSilverlightObject&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mainCanvas=vobj.content.findName(&amp;quot;RectangleID&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mainc=Convert.ToCanvas(mainCanvas);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sc=Convert.ToSolidColorBrush(mainc.get_background());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bgcolor=sc.get_color();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bgcolor=&lt;b&gt;getFillColor&lt;/b&gt;(bgcolor); &lt;/p&gt;&lt;p&gt;//-------------------------------------------------------------------------------&lt;br /&gt;//-------Color value convertor function&lt;br /&gt;//-------Hexadecimal value from RGB Value&lt;br /&gt;//-------------------------------------------------------------------------------&lt;br /&gt;function &lt;b&gt;getFillColor&lt;/b&gt;(color) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; var fill = color;&lt;br /&gt;&amp;nbsp;&amp;nbsp; if (fill &amp;lt; 0) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fill = (16777216 + parseInt(fill));&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; fill = fill.toString(16);&lt;br /&gt;&amp;nbsp;&amp;nbsp; if (fill.length &amp;gt; 6) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fill = fill.substr(fill.length - 6);&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; while (fill.length &amp;lt; 6) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fill = &amp;quot;0&amp;quot; + fill;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; fill = &amp;quot;#ff&amp;quot; + fill;&lt;br /&gt;&amp;nbsp;&amp;nbsp; return fill;&lt;br /&gt;} &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/14813.aspx</link><pubDate>Thu, 20 Sep 2007 00:49:39 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:14813</guid><dc:creator>Jeff Paries</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/14813.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=14813</wfw:commentRss><description>&lt;p&gt;There is a thread on converting the color value you get here:&lt;br /&gt;http://silverlight.net/forums/t/4710.aspx&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/14759.aspx</link><pubDate>Wed, 19 Sep 2007 15:31:20 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:14759</guid><dc:creator>TBink</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/14759.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=14759</wfw:commentRss><description>&lt;p&gt;Nope...&amp;nbsp; In VisStudio I see&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;Sender.Fill.toString()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;SolidColorBrush&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String&lt;/p&gt;
&lt;p&gt;I did do this work around since I simply want to apply the color of another object ... I can use the long value... so, &lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;font size="2"&gt; SndFill = Sender.Fill.Color&lt;br /&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;var&lt;/font&gt;&lt;font size="2"&gt; TmpRct = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;lt;Rectangle Canvas.Left=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+(XPos-10)+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Canvas.Top=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+(YPos-10)+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Width=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+SWd+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Height=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+SHt+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Fill=&amp;quot;red&amp;quot; StrokeThickness=&amp;quot;1&amp;quot; Stroke=&amp;quot;blue&amp;quot; Opacity=&amp;quot;0.35&amp;quot; IsHitTestVisible=&amp;quot;false&amp;quot;/&amp;gt;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.TempBlock = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.control.content.CreateFromXaml(TmpRct);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.TempBlock.Fill.Color = SndFill;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;.... this works but it bothers me that I can&amp;#39;t get a hex value for the color ....&amp;nbsp; seems to me to be a minor bug in the object model&lt;/p&gt;
&lt;p&gt;What I&amp;#39;d like to do is (bold italic):&lt;/p&gt;
&lt;p&gt;var&lt;font size="2"&gt; TmpRct = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;lt;Rectangle Canvas.Left=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+(XPos-10)+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Canvas.Top=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+(YPos-10)+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Width=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+SWd+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; Height=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+SHt+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; &lt;strong&gt;&lt;em&gt;&amp;nbsp;Fill==&amp;quot;&amp;#39;&lt;font color="#000000" size="2"&gt;+SndFill +&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot;&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt; StrokeThickness=&amp;quot;1&amp;quot; Stroke=&amp;quot;blue&amp;quot; Opacity=&amp;quot;0.35&amp;quot; IsHitTestVisible=&amp;quot;false&amp;quot;/&amp;gt;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;But this fails because its a long number&lt;/p&gt;
&lt;p&gt;By the way there&amp;#39;s the same issue with Stroke &lt;/p&gt;
&lt;p&gt;Sender.Stroke.toString()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;SolidColorBrush&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String&lt;/p&gt;
&lt;p&gt;tom&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/14758.aspx</link><pubDate>Wed, 19 Sep 2007 15:22:36 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:14758</guid><dc:creator>Dave Britton</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/14758.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=14758</wfw:commentRss><description>&lt;p&gt;does fill.tostring() work?&lt;/p&gt;
&lt;p&gt;=&amp;gt; Dave&lt;/p&gt;</description></item><item><title>How to GET the color of FILL</title><link>http://forums.silverlight.net/forums/thread/14756.aspx</link><pubDate>Wed, 19 Sep 2007 15:17:59 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:14756</guid><dc:creator>TBink</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/14756.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=16&amp;PostID=14756</wfw:commentRss><description>&lt;p&gt;I want to GET the color of the FILL of a Rectangle....&amp;nbsp; the object xaml&lt;/p&gt;
&lt;p&gt;&amp;lt;Rectangle X:Name=&amp;quot;Test&amp;quot; Fill=&amp;quot;&lt;font color="#0000ff" size="2"&gt;#FFF85B5B&lt;/font&gt;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;via script I want to get that color value and apply&amp;nbsp;it to another object&amp;nbsp;... I can&amp;#39;t find the way...&lt;/p&gt;
&lt;p&gt;on mouse down I tried:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;var&lt;/font&gt;&lt;font size="2"&gt; SndFill = Sender.Fill&lt;br /&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;font size="2"&gt; TmpRct = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;lt;Rectangle Canvas.Left=&amp;quot;100&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot; Canvas.Top=&amp;quot;100&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot; Width=&amp;quot;50&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot; Height=&amp;quot;50&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot; Fill=&amp;quot;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;+SndFill+&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;#39;&amp;quot; StrokeThickness=&amp;quot;1&amp;quot; Stroke=&amp;quot;blue&amp;quot;&amp;nbsp; /&amp;gt;&amp;#39;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;This fails and when I look at the text output for TmpRct I see&amp;nbsp;&amp;nbsp; &lt;strong&gt;Fill=&amp;quot;SolidColorBrush&amp;quot;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Sender.Fill.Color&lt;/strong&gt; gives a non hexidecimal, long number ...&amp;nbsp; -500901&amp;nbsp; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;What&amp;#39;s the solution...?&lt;/font&gt;&lt;/p&gt;tom&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>