in

WPF Design and Development

IdentityMine Team Blogs

David Kelley

A day in the life of a humble software architect... doing C#, WPF, Silverlight, Legos, Fuzzy Logic AI and/or whatever is the latest and greatest or more importantly the coolest techo mumbo jumbo...

August 2007 - Posts

  • Internet Questionaries... and Silverlight preformance etc

    So I took this quiz and I disagree with the results but its kind of cool.  I think that some of the questions like 'Have I said something that made some one cry' and I answered 'Yes and they deserved it' need to be understood in context...  lol

    I AM 84% MEGATRON

    Take the Transformers Quiz

    My point in bring this up is that Silverlight is a great tool for doing web developement but like anything we need to use it carefully.  Silverlight for example can be used to create things like this that provide a rich interactive experience that is a draw for users.  Great for marketing.  I just hope people understand that not everything like this is the 'gospel' true or thought out by a shrink...  :) 

     Also here is a cool link on Silverlight preformance vs other bits that some one sent out.  It is particularly interesting to see perf between 1.0 and 1.1 Silverlight.  Silverlight 1.1 when it is finally released will have a lot of capability to do processing much faster then say JavaScript.  So the example I talked with some one at MS about recently was the chess model where the intellecency or 'chess' algorythm was implemented in Silverlight vs JavaScript and it make the client side game 'much' faster.  Note that I have had trouble with this link (as in it only works for me some times...) http://bubblemark.com/ 

    Also in comparing Silverlight vs. Flash Jared came up with some interesting points in a recent email thread running around the company:

    ·         Silverlight has much more robust way of communicating with the DOM. Finding external HTML objects, JavaScript functions and communicating with them feels completely natural.·         Silverlight 1.1 supports DRM where flash video does not. Nokia and other mobile carriers have just signed off on Microsoft’s PlayReady technology.·         It also uses the standard VC-1 codec, the we are beginning to see on HD DVD and Blue Ray disks·         XAML is hot   (I personally think markup design has huge potential on the web and with blogger. “Throw some funny colors, shapes and text on my blog.. no problem. I’ll write it”)

    ·         Video Brush

    ·         I also think the DLR has a lot of potential. It currently supports four dynamic languages built on top: Python, JavaScript (ECMAScript 3.0), Visual Basic and Ruby. But allows anyone to write their own parser.

    (from Jared)

    And some other points on the thread included:

    1. Silverlight uses XAML so working with Vectors is more “open” than flash… This is hugely beneficial… Howerver Flash tooling for vectors is more robust at the moment… Some benefits that Silverlight has is Gradients on stroke… Otherwise silverlight vector features is pretty comparable to SVG which is pretty comparable to flash. Render wise… WPF is better than Flash (at least I think so). I know Silverlight has different rendering engine than WPF though and I don’t think we get sub pixel rendering benefits of WPF… But hopefully some of our knowledge from WPF MIL is in Silverlight. 2.  Both Silverlight and Flash have preloader solutions… Both of these have been mostly roll your own… But both offer APIs that are useful. My bet is Flash has more years of experience here so its better… But I don’t think anything would be a deal breaker.  More variance in existing community solutions for Flash… More openess for Silverlight.

    Silverlight’s WMV media support is better and WMV is a better codec than the On2 codec for Flash (personal opinion) but ...

    Silverlight allows you to do .net in 1.1 which is blazingly faster than JS and AS…

    (quoted from Nathan)

    Anyway so I think that these guys have some good solid info on this thread that everyone would find useful.

  • Our Rising Star and Silverlight 1.1 Templates in XAML

    We have this young 'intern' working here 'Devin Brown' that has done brillaint Silverlight work.  Besides this he took the time to do this blog post on Templates in XAML/Silverlight 1.1.  Way cool, check it out. 

    http://blog.identitymine.com/blogs/devin_brown/archive/2007/08/09/silverlight-templates.aspx 

  • Creating a 'Path' Object in Silverlight 1.0 RC1

    What is a ‘path’?  A Xaml tag or object that defines a complex shape or polygon of some kind via a connected line which may make be an actual polygon and or consist of points, lines and arch’s.  Everything from character to slices of a pie chart can be built using ‘paths’.  Typically the ‘path’ is defined by its data property so typically a path is going to be something like this:

                    <Path Name=”MyPath” Stroke=”…” Fill=”…” Data=”…” …/>

    At the very least, you may also use Canvas.Left and Canvas.Top or just place it in a canvas etc as well.  A designer normally would be abstracted from actually building a path by hand but in cases such as building a pie chart one might want to write code to dynamically build slices of the pie chart programmatically and so therefore would want to know the syntax of the ‘data’ property on a path so they could compute it in their code.

    How do I define a Path myself? To start with you must define a start point which is designated by ‘m’ (not case sensitive) and a point such as ‘M 10, 10’.  You also need to define an end point which could be the same point so something like ‘L 10, 10’.  So lets check out the types of things I can pass in. 

    If our start point is say ‘M 10, 10’ and we want to draw a horizontal line we can then do use the horizontal line command like this: ‘H x’ which might look like this then: ‘M 10, 10 H 150’.  Next we can draw a line down using the vertical line command like this: ‘M 10, 10 H 150 V 150’ and if you use the L point from earlier we get a horizontal line and then a vertical line and a line from that point back to where we started which creates a triangle.  (see the Path Sample Part 1).

    So to get creative we can then use the Cubic Bezier Curve Command designated by ‘C’ so from the end point of our vertical line command we can then draw a Curve using 2 control points like this: ‘C 100, 100 200, 200 50, 50’.  This shape would then give us this funky triangle shape with a weird ‘foot’ at the bottom. 

    We can also use the Quadratic Bezier Curve Command which would be ‘Q point1 end point’ where point 1 is our control point we could use the ‘Smooth Cubic Bezier Curve Command that is ‘S point1 end point where point1 is the control point for a regular curve or use ‘T’ to make the curve quadratic.

    My favorite command is the Elliptical Arc Command which  can be used to create a slice curve such as the curve of a pie slice.  The syntax is ‘A size rotationAngle isLargeArcAngle sweepDirectionFlag endpoint’.  These are the following:

    ·         Size: this is the radius of the arch in pixels

    ·         Rotation Angle: is the angle of rotation of the curve in degrees

    ·         ‘Is Large Arc Angle’: is a flag that sets the render of the arch to be 180 degrees or greater if set to 1 where the default is 0

    ·         ‘Sweep Direction Flag’: is a flag determining if the arc is to be drawn from a positive angle or not from the point if set to 1 but default is 0

    ·         ‘End Point’ is just that the X,Y end point of our Arc

    So if we use an arc definition like this: A 50, 50 200 1 0 100, 100 added to our sample (see Path Sample 3) we get a crazy but cool shape.  That you really have to see to understand… note how the fill is applied effectively making 2 ‘shapes’.   The entire definition would look like this:

                    <Path Name="PathElement" Data="M 10, 10 H 150 V 150

                                                    C 155,155 160,160 140,165

                                                    A 50, 50 200 1 0 100,100

                                                    L 10, 10" 

                                                    Stroke="#3c5f0c" StrokeThickness="3" 

                                                    Fill="#728f4a"

                                    /> 

    Check out the SDK for more detailed on Path definition syntax or paths in general.

     

More Posts
© 2007 IdentityMine, Inc.
Powered by Community Server (Commercial Edition), by Telligent Systems