Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll start from the second point.</p> <p>First, the inner logic of <code>StrokeDashArray</code> is explained <a href="http://msdn.microsoft.com/en-us/library/bb980148%28v=vs.95%29.aspx" rel="nofollow noreferrer">here</a>. The important point is that the stroke dash array is not expressed in pixels, it's dependent upon stroke thickness to get the final pixel value for each number in the array.</p> <p>So, for the math part, lets define some variables:</p> <ol> <li>S - visible portion of the stroke (same as in the link).</li> <li>G - the non-visible portion of the stroke (same as in the link).</li> <li>r - the radius of your chip. It will be half of the actual width or half of the actual height.</li> <li>n - the number of repetitions of S+G that you want. Integer.</li> <li>T - stroke thickness</li> <li>p - the mathematical pi (3.14...)</li> </ol> <p>So we have:</p> <pre><code>2*p*r = n*(T*S+T*G) </code></pre> <p>Or,</p> <pre><code>S+G = 2pr/nT </code></pre> <p>In your case, and what I see from the image of the chip, the visible part of the stroke is square so S=1, there are six white squares with six gaps so n=6 and you decided for thickness of 30px so T=30. This gives you the value of G as:</p> <pre><code>G = 2pr/180 - 1 </code></pre> <p>You can get the value of r from blend, the actual width and height will be written in parenthesis in the Width and Height boxes - divide it by two. From the details that you provided, I guess the radius is 102.55. And the final stroke dash array is:</p> <pre><code>StrokeDashArray="1,2.58" </code></pre> <p>For your first point, the answer is: it depends. If your chip is the same throughout the life-time of the application - this is the best way. It gives you the slight curvature on the outside to make the "square" flush with the outer contour of the chip and it requires a one-time calculation in design time.</p> <p>Even if you have different sizes for the chip, this might be the best way to implement the graphics for the chip. Provided, you can design it with fixed size and then sticking it into a <code>ViewBox</code> and it still looks good.</p> <p>If there's a need for variable sizes and the view box route doesn't work - there's another way to implement it (because Silverlight fails when you bind to ActualWidth\ActualHeight properties) - with <code>Border</code>s that hold rectangles. But it opens a whole new can of worms, and this answer is long enough. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload