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...

September 2007 - Posts

  • ASP.NET Server Controls in VS 2008 and .NET 3.5 and Sharepoint

    Today is going to be a bit of a rant.  Background on the issue is that in VS 2005 I have written server controls for ASP.NET and Web Parts for Share Point.  Typically for building Share Point web parts I like to developement them as server controls to so I have this nice easy structure to work with until I have something that does basically what I want.  The trick with a server control is basically basic C# stuff.  First you make a class and inherit from your base control and then you overwrite a method and add some declaritive stuff and then you can use it on your page by using a register in the ASPX.  Then you can use your tag to create an instance of your control.  Also this can then be put into its own dll and added to VS's toolbar and you can pass the dll around to friends etc and everyone can have this cool dll.  Now to turn the control into a web part basically you change the base class, add a few using statements and change the output method name, make sure its all in a dll and your good.  So far so good right?

    For a server control, the class basically looks like this:

    [ToolboxData("<{0}:SomeName id=\"\" runat=\"server\" />")]

    public class SomeName: System.Web.UI.WebControls.WebControl

    {

         protected override void Render(HtmlTextWriter writer)

         {

              writer.Write(PresentHTML()); // some method we make...

         }

    }

    We also add a few bindable properties like id or width or title or something that might look like this:

    private string _Id = string.Empty;

    [Bindable(true), Category("Appearance"), DefaultValue("")] public string id

    {

         get

         {

              return _Id;

         }

         set

         {

              _Id =
    value;

         }

    }

    Again straight forward stuff. right?  We also might add other functionality of course and we have it in a name space but this is the key bits above.  Now to turn this into a 'WebPart' we make it look something like this:

    [DefaultProperty("Text"),

    ToolboxData("<{0}:MyWebPart runat=server></{0}:MyWebPart>"),

    XmlRoot(Namespace = "MyWebPart")]

    public class MyWebPart : WebPart

    {

         private string _Id = string.Empty;

         [Bindable(true), Category("Appearance"), DefaultValue("")]

         public string id

         {

              get

              {

                   return _Id;

              }

              set

              {

                   _Id =
    value;

              }

          }

     
        protected override void RenderWebPart(HtmlTextWriter writer)

         {

              writer.Write(PresentHTML());  // our private method that does the real work...

         }

    }

    not a big change and again pretty straight forward.  I dont' show all the properties and methods like the one reference to 'PresentHTML' which is just a private method that returns a string.  This is the basic stuff needed for sharepoint.  The one other thing is to make sure you have the using statements that reference all our Sharepoint bits:

    using Microsoft.SharePoint.Utilities;

    using Microsoft.SharePoint.WebPartPages;

    using Microsoft.SharePoint.WebControls;

    and of course the sharepoint dll that your building to needs to be referenced.  So to use the server control version you have to create a Register tag in your ASP.NET that looks like this:

    <%@ Register TagPrefix="prefix" Namespace="ControlNameSpace" %>

    then in the ASPX page we can add the tag for our control to test it without all the jumping around you need todo with Share Point.  In this case it might look like this:

    <prefix:SomeName id="ItemName" runat="server" />

    This is 'All Good' in VS 2005 but the other day (earlier this morning) I had to make it work in VS 2008 for embededing a webpart 'Silverlight' control into Sharepoint.  So I got to the test page of the silverlight project and do basically the above and make a web part that writes out all my Silverlight stuff (actually it was Devin's Silverlight app).  This way we care wire up bits that the web part needs to pass into the Silverlight class todo its thing for when it actually has to live in Sharepoint.  I would have thought this easy enough...

    So I add the class and set it up as a server control.  I add the references, and the register for the tag prefix and namespace reference and then add a tag to the control that should create the silverlight app.  I compile it and try to run it and it blows up entirely.  After fighting with this for some time it turns out that you need to have an 'Assembly' reference in the register tag in VS 2008/.NET 3.5 for a server control to be able to run in ASP.NET 3.5.  So then it looks something more like this:

    <%@ Register TagPrefix="prefix" Namespace="ServiceNamespace" Assembly="SilverlightApp" %>

    The part that bothered me is that if the class is in the same assembly as the rest of the site and we call out the name space and class specifically it should be able to find the default assembly since its run in that assembly... but alas I was wrong.  Not that, that is a surprise but  it always seems to surprise me when I am. :)

  • Building a TextBox in Silverlight 1.0...

    One of the problems I have seen a lot of is building full blown forms in Silverlight 1.0.  For the most part, Silverlight apps have placed HTML over Silverlight.  This certainly works, albeit not the ideal situation and Silverlight 1.1 promises to deliver us a real text box.  However, in the mean time, I decided I needed a 'Silverlight 1.0' text box.  So here is how I made one work.

    In building a text block there are a number of key bits of functionality we need todo: making the control look like a text box, making the text box behave with focus like a text box (have a cursor) and getting key board events into the text box.  If you can address these then things like wrap, overflow and size ratio's etc are pretty straight forward. 

    Actually making a control to look like a text box is not too hard.  Basically we have a canvas with a nice boarder in XAML and you can make something that looks like a text box.  In this case something like this:

      <Canvas x:Name="TextBox" Canvas.Top="10" Canvas.Left="10" Height="13" Width="100" Cursor="Hand" >
       <Rectangle Name="TextBoxBackGround" Height="13" Width="100" Fill="#FFFFFF" Stroke="#999999" StrokeThickness="1" >
       </Rectangle>
       <Rectangle Name="TextBoxBackGround2" Height="13" Width="100" Stroke="#999999" StrokeThickness="1" >
        <Rectangle.Fill>
         <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
          <GradientStop Color="#00000000" Offset="0"/>
          <GradientStop Color="#33333333" Offset="1"/>
         </LinearGradientBrush>
        </Rectangle.Fill>
       </Rectangle>
      </Canvas>

     Nice and simple.  Now that it 'looks' like a text box we need to have a cursor when it gets focus...  For the cursor you can do a number of other things but lets start with a little line rectangle.  We set the size and starting position in our XAML and then make it invisable.  In our code behind we wire up an event on the box so that on 'MouseLeftButtonDown' we get the event and set the 'textbox' into a focus state.  Basically these means we set a flag, changed opacity and started an animation on the cursor to make it blink. 

     Now our text block looks like a text block when we click on it and the cursor shows up...  Now we need to actually make it work. Todo this we can add a text block element and wire an additional event to the document object of the page to capture keyboard events.  In our keyboard event handler we need to check the key codes against our look up table so we know what they mean and add the character to our text box.  If we run our text block now we notice that this appears to work but the cursor doesn't move.  So then we make our event handler move the cusor as well.

    So in less then a few hundred lines of code we have a working text box.  From here we now need to be able to deal with text overflow moving the cursor back and forth and sizes and ratios.  When the control is wrapped nicely in a class and xaml file we can use it in our projects by just creating the class and passing in a destination or target and 'poof' instance text box.  Almost like its built in.

    Now to see if anyone is actually reading the blog...  If any one is interested in the code let me know. :)

     Ok Ok, so it seems some one actually does really read my blog.  :)  I feel much better so I'm going to post more on the text box.

    Lets start by updating our xaml a bit.

      <Canvas x:Name="TextBox" Canvas.Top="10" Canvas.Left="10" Height="15" Width="150" Cursor="Hand" >
       <Canvas.Resources>
        <Storyboard x:Name="CursorAnimation" >
         <DoubleAnimation
          Storyboard.TargetName="TextBoxCursor"
          Storyboard.TargetProperty="Opacity"
          To="0"
          From="1"
          RepeatBehavior="Forever"
          Duration="0:0:.5" />       
        </Storyboard>
       </Canvas.Resources>
       <Rectangle Name="TextBoxBackGround" Height="15" Width="150" Fill="#FFFFFF" Stroke="#999999" StrokeThickness="1" >
       </Rectangle>
       <Rectangle Name="TextBoxBackGround2" Height="15" Width="150" Stroke="#999999" StrokeThickness="1" >
        <Rectangle.Fill>
         <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
          <GradientStop Color="#00000000" Offset="0"/>
          <GradientStop Color="#33333333" Offset="1"/>
         </LinearGradientBrush>
        </Rectangle.Fill>
       </Rectangle>
       <TextBlock x:Name="TextBoxText" Width="148" FontSize="12" Canvas.Left="1" FontWeight="Normal" Foreground="#000000" ></TextBlock >
         
       <Rectangle x:Name="TextBoxCursor" StrokeThickness="1" Height="12" Width="1" Fill="#999999" Canvas.Left="2" Canvas.Top="1.5" Opacity="0" ></Rectangle>
      </Canvas>

    now we have added the cursor and textblock we talked about earlier.  In our code behind we have our event handler called:

    TextBox_OnKeyPress and an initialization routine called InitTextBox.  In the onload event we then call our iniatilizer and wire up the key press event handler.  Now the trick here is that we are not wiring anything to 'silverlight' persay but in IE we wire it up to the document object like this: 

    function onload(sender, args)
    {  
     InitTextBox(sender);
     document.onkeyup = TextBox_OnKeyPress;
    }

    Ideally this all is wrapped in a consumable control which I'm will finish when I finish this cool char size algorythm so everything isn't hard coded but in the mean time this example uses a number of present values in the xaml and things like font size and base increment in the code.  Also there is a GetWidth function with hard coded values that is used for moving the cursor on the text box surface.

    So back to our function InitTextBox(sender).  In the sample I did initially this function basically saves some references to different parts of the control such as the cursor and text box for manipulation and then it adds an event listener to the text box canvas.  This function is around actually giving the control 'focus' effectiving.   There are a few other things you might want todo that is not in the sample like code for getting the control out of focus etc.  So our add event in the initializer looks like this: 

     TextBox.addEventListener("MouseLeftButtonDown", function( sender, args )
      { 
       IsTextBoxMouseCaptured = true;
       TextBoxCursor.Opacity = "1";
       CursorAnimation.begin();
      }  );

    So when some one actually clicks on to the control we set our flocus flag to true and turn the cursor on by setting the opacity and turning on the blink animation. 

    Back to our key press event.  This guy remember we wired up to the document object but we only want to get events when the control has focus.  That means in the event handler we need to test for the flag and if true then we can do something.  Here is a sample:

    function TextBox_OnKeyPress()
    {
     if( IsTextBoxMouseCaptured )
     {
      var EventCode = Number(event.keyCode);
      
      switch(EventCode)
      {
       case 48: SetCharacter( "0", ")", event.shiftKey ); break;

       case 37:
        TextBoxCursor["Canvas.Left"] = LastPosition();
        break;
      }
     

    So in this case we see the flag test and then we grab our 'EventCode' from the keyboard and we use a case statement to determine what character this is and what todo.  To make the example easier I removed all but two character examples.  The first case we are dealing with the zero/close paren key.  Note we call a function called SetCharacter and pass in three events.  The SetCharacter function gets the current shown text, determines which charater we want based on shift condition adds the charater to the real text value we keep in a variable and then determines what text is to be shown places the text and calculates the cursor position based on another function called GetWidth which determines all the offsets from the base character size (this is the one that needs the cool algorythm so all the values are not hard coded...).

    The last case is a move back button which calls the 'LastPosition' function and moves the cursor based on the character behind it.  So that is basically all the key aspects of doing a text box in Silverlight 1.0. 


     }
    }

  • Parsing XML in Silverlight 1.0 - Cross Browser

    So the little XML mini me is great for simple stuff but when you really need to do real work with XML you really need a more robust solution that includes a real XML parser.  Now that can prove problematic especially when it has to work in lots of browsers.  To address this problem with my own work I wrote another class that wraps the cross browser functionality and wraps some key elements that I use.  Typically I need things like all of properties of a given node in a list in the form of an array.  Plus things like xPath and the like for Silverlight. 

     So the attached javascript class wraps the core functionality.  It includes the HTTP request functionality and XML parsing with the other bits I 'might' need.  Basically the class works like this:

    var NewDOM = new XML();
    NewDOM.Load("Sample.xml");

    This code fires when the html page script code behind fires.  When you call 'Load' and pass a url to an xml file it then depending on the browser it uses the appropriate HTTP request object to load the file and assign the onload event.  On the XML files load the call back is called and the object does the appropriate processing.  Once this does its thing we now can use it to parse our XML. 

    On the onload event for the page in my little test I make two calls to different methods.  The same methods are supported on this class as the XML mini me but additional ones are included like 'SelectNodesAttributes'.  Also I noticed in firefox by 'onload event gets called twice so I put a flag on it so it only fires once.  So in this sample I call the two methods that return arrays but you can have direct access to the DOM and use xPath etc using NewDOM.XmlDocument.

  • Path Performance Issues in Silverlight

    So I was talking to Jared and Devin and the other designer/integrator types this morning and some one pointed out that when you create a Path that uses stretch and has a height and width Silverlight takes a huge preformance hit.  Not sure why this is as it doen'st appear to be an issue in WPF that I know of but it seems to be a 'don't do that' in Silverlight... 

  • Silverlight Host Loosing Mouse Capture...

    So one issue we have had to deal with in Silverlight is loosing Mouse Capture.  So inside the context of a silverlight application this isn't an issue.  The problem is when we have a small embeded silverlight app, say a media player for instance that we want to be able to be dragged and resized dynamically accross the page over HTML content and back.  We can build this application so it has a typical windows like drag corner that you can left down click on and then drag out to resize.  In theory this works.  The issue is if the mouse ever gets off of the silverlight app surface, which is very easy todo, Silverlight still thinks it has the mouse captured but events are no longer received and the on mouse up never gets fired.   Further when you move back on to the Silverlight surface you still have managed to loose the mouse and code can get easily confused ie: say your using a flag to determine if the mouse is captured since silverlight currently doesn't have a 'isMouseCaptured' property etc.

    So now we have framed the problem here is how we solved it.  So even though the media player visually one size  when we first catch the mouse down on the drag corner we actually change the size of the underlying aghost for silverlight to be an extra buffer of so many pixels.  So now the aghost makes it much harder for the user to get the mouse off of the silverlight surface so we basically run around the screen and chase after the mouse.  On drop then we resize the aghost to match the current drag corner position.  On IE this works really well, on firefox it is more problematic but does work well if done correctly.  On Safari on the Mac the drag works well but Safari is generally more touchy around the html dom.

    Another point or rather surprise for me was making this same player work on Safari on the Mac...  lets not get confused with Safari on windows which as of this post blows up on contact with silverlight.  But anyway. on the Mac, Silverlight runs as smoothly as in IE especially with this particular mouse capture issue.  Hmm...  makes me wonder if it is just Firefox...

  • Cross Browser XML Parsing in Silverlight

    One problem we have seen and dealt with allot lately is parsing XML client side.  My favorite solution I must admit is to just toss out XML and use JSON as it is so much more elegant.  In the case of the ET Minisite we did as of late this turned out to solve a lot of our problems.  But still what if I can't do JSON for whatever reason?  if you only care about IE or even firefox that seems to be much less of a problem.  But for a really cross browser experience I my solution is the XML document mini me.  Granted this is a bit of hack (like much of JavaScript and Silverlight)... :)  but it works well... IF your XML is pretty stable and IF there isn't to much XML weirdness like multipul nested levels and such but it works. 

    So the XML Mini me is a simple XML parseing engine written in Javascript.  It only supports a limited subset of something like the real xml parser in .NET like XMLReader or even XMLDocument but it does so a few simple things including some simple xPath like behavior.  I hestiate to say a subset of xpath as the mini me is so extremely limited.  I also suspect that the silverlight team at some point will have a good XML parser built in to silverlight at some point but we will see.  there is of course Silverlight 1.1 but if you can't do the .NET part it doesn't do much goo.

    In Silverlight, you have the downloader object so its really reasonable get XML easily no matter what.  So then using the XML mini me looks something like this:

    var MyDom = new XMLDocument();

    MyDom.LoadXML( SomeXML);

    I tried to keep the syntax as famliar as possible.  So now we have our XMLDOM called 'MyDom' and then to get data out we can do this:

    var ArrayOfVAlues = MyDom.SelectNodes("//items");

    In this case the mini me will return all the text values of all the items nodes in the dom in the form of an array.  Underneath the covers the parser is just doing some 'string' manipulation but for small groups or data or simple RSS feeds or config files it seems to work well.  large XML parseing would scary me preformance wise as would writing a more full featured parser that is entirely written in JavaScript.

    Some things to note on the class is that it has an XML property like the XML parser we used to use in classic ASP but otherwise it only has two methods currently as those are the ones I need to get it working for my particular project.  lets look at the XML it can deal with for starters, here is a sample:

     <xml>

         <collection type="foobar" count="4">

              <item>

                   <url>http://www.identitymine.com</url>

              <item>

              <item>

                   <url>http://www.identitymine.com</url>

              <item>

              <item>

                   <url>http://www.identitymine.com</url>

              <item>

              <item>

                   <url>http://www.identitymine.com</url>

              <item>

              <item>

                   <url>

                        <![CDATA[http://www.identitymine.com]]>

                   </url>

              <item>

         </collection>

    </xml>

    So in this sample using some simple xml our parse deals with it easily.  In this case when we make a call to SelectNodes("//url") we will get an array of all the urls values with all the <![CDATA stuff stripped off into an array.  simple, easy and fast but easly breakable if you muck up the xml to much.  So for the time being its a great stop gap and if JavaScript works then this works at it uses only intrinsic language features.

  • ET Online and Silverlight

    Check out this site that we build in Silverlight...

     http://www.etonline.com/emmys/ 

    This site was built in one week... lots of blood sweat and tears and thousands of lines of JavaScript... 

     The fact that we build this in one week really show cases the ability of designers and developers to work together.  If we had to do this in flash I would have jumped off the top of the building.  don't get me wrong, there are lots of cool things about Silverlight and the media stuff is cool but the ability to bring the designer and developer together and deliver such complicated web content is what Silverlight is all about. 

    One specific coolness is the control architecture we were able todo with Silverlight and JavaScript.  Granted anything with a real CLR and C# is a different ball game but we really were able to come up with solid Silverlight 1.0 control architecture that abstracts the control code well and the XAML and further all of that from the actual application and its XAML in an elegant way that everyone can work on their own bits without stepping on anyone else.  without this kind of design and architecture allowed by silverlight this would not have been possible.

    The team at Identitymine really came together not only with each other but with REZN8, Entertainment Tonight/CBS and Microsoft to wip out an just unbelieve web experience.

     A special thanks to the team: Andrew Whiddett, Mark Brown, Paul Alexander, Jordan Hughes, Devin Brown, Victor Gaudioso, Jobi Joy, Sajiv Thomas, Joy George, Franklin Jose, Haridas Nair, Nathan Dunlap, Jared Potter (the man), Dale Jones, Sam Lakshmipathy, Liby Simanthy, Praveen Prabhakar, Ileana Garcia-Montes, John O'Keefe, Paul Sidlo and to any one else I forgot thank you. 

    So especially the guys I kept finding in their office or laying on the couch with 2 hours of sleep and jumping up at slightest call and probably even more so the Spouses that had to put up with us...

     and we got it on the silverlight.net site:

    http://silverlight.net/Default.aspx

    and some other links that mentioned this (as of noon on the day of the site launch):

    http://www.microsoft.com/SILVERLIGHT/

    http://www.ehomeupgrade.com/entry/4236/microsoft_delivers_silverlight

    http://blogs.msdn.com/angus_logan/archive/2007/03/17/k2-starts-up-their-marketing-machine-w-blackpearl-mini-site.aspx

    http://biz.yahoo.com/prnews/070905/aqw071.html?.v=20

    http://www.hollywoodreporter.com/hr/content_display/news/e3i60f5b2f4b4752ad5475f800535e5fd7b

    http://news.moneycentral.msn.com/provider/providerarticle.aspx?feed=PR&date=20070905&id=7416843

    http://blogs.msdn.com/jgalasyn/archive/2007/09/05/silverlight-1-0-released-to-web-linux-support-announced.aspx

    http://www.linuxworld.com/news/2007/090507-microsoft-flash.html 

    http://www.beet.tv/

     

    ps... this is hosted on Linux/Apache...

  • Identitymine Does it Again...

    check out this link:

    http://www.brockett.net/?p=232

     More to come...

  • JavaScript Class Structures

    So 8 years ago or so I worked for this company and was hired to fix and admin tool they wrote in JavaScript...  The system had 10's of thousands of lines and loaded as an HTA and looked and feeled like a win 32 app.  This was cool but everything they used visual studio to debug everything feel to pieces.  I spent a long time looking over the code and what bothered me was how they laid out classes.  They would always declare a class (function) and then add functions to it effectively making them all global.  It turns out when a move of a curlly braces so that it appeared more like a traditional class (minus the key word class) with the methods(functions) being nested in the class (top function).  Like magic the application preformance went up and visual studio stopped blowing up on contact.  It was really amazing.  Since then I have been pretty sold on using a JavaScript class structure like this...  Over the years my self rightousnous about JavaScript has grown to the point of having trouble getting in the door with my big head...  What is the saying the bigger they are the harder they fall.  Anyway in my self rightousness I over looked a little key word called 'prototype'.  I don't know if it just wasn't around 10 years ago when I started JavaScript and came later or what but one day I wake up and there is class structure using prototypes that gives me heart burn as it keeps giving me flash backs to this one project.  And alas I have learned something new.  With all my winnying about properly structured javascript some one pointed out that oh look this key word makes all instances use the same copy...  gasp choke [descriptive explative] what?  So I ask to see the link and do a bit of research.  and what do you know a better way of doing something.

    So it turns out that if I declare my class with its properties and then declare using prototype my methods then all instances of the class use the same method.  this is also how to extend core classes as well.  (dah, as I have seen that before)  So then the new rule is that proper javascript class declarations should look like this:

     function myclass()

    {

         this.WhateverProperty = "";

    }

    myclass.prototype =

    {

         Method1: function( param1, param2 )

         {

              // some code

         },

         method2: function( param1, param2 )

         {

              //some more code

         }

    }

    Yes I know my curly braces are matching and not the OLD school javascript standard but will all the other languages it just seems to be that JavaScript should follow suit,  anyway this is how a javascript class should look like until I am proved otherwise... (hmm.  setting my self up again).  :)

  • Silverlight 1.0, JSON and (gasp) PHP

    So we are doing this really cool Silverlight app that I'll blog lots about when it goes live but one particular thing that is cool is our use of JSON.  One one isues was that we are hosting this on a non microsoft approved web server...  gasp (I know, those of you that know me will be in shock, but really when it comes to down to it I follow the money :) In any case so Mark writes this PHP service that takes some xml feed and transforms it to XAML but we also need some meta data so that when added to the application we can dynamically bind our silverlight 1.0 controls to the elements.  Mark decided to try added a text area that would not be visible and put the JSON meta data there and poof, one little eval and we have our meta data and our transformed XAML...  a little XSLT on the server in PHP and the source XML feed works way cooler then having todo in all clientside in silverlight... 

  • Drag and Drop Made Easy in Silverlight 1.0

    I keep getting the question on how to do drag and drop with silverlight.  I also keep getting samples that look basically this this, some bit of xaml has a number of events assigned to it and then a set value function of some kind and then everything with similiar functionality does the same thing and on drop we fire some event which basically makes for clutter code.  So I wrote a simple function that basically boils down this this.  One line of code and a delegate and a library function.  In our code lets say we have some xaml.  this sample is simple but you get the idea.


      <Ellipse Name="SomeElement"
       Height="10"
       Width="10"
       Canvas.Top="0"
       Fill="#728f4a"
       Stroke="#3c5f0c"
       StrokeThickness="1"
       Cursor="Hand"
       />

    In our code behine we have our onload event...  at least most reasonable silverlight I have seen uses this event. 

     MakeDragable( sender, "SomeElement", ThisDelagate);

     Sender is our the reference to the top canvas passed automagically into all events from silverlight.  The next parameter is the name of the silverlight element we want dragable and then 'ThisDelage' is a reference to the function we want to use as our drop delegate.  In this case our library function looks like this:

     var IsCaptured = new Array(0);

    function MakeDragable( Root, ElementName, Delegate)
    {
        var ThisIndex = IsCaptured.length
       
        IsCaptured = new Array(IsCaptured.length);
       
        IsCaptured[ThisIndex] = false;
       
        var Dragable = Root.findName(ElementName); 
       
        Dragable.addEventListener("MouseLeftButtonUp", function( sender, args ) { sender.releaseMouseCapture();  IsCaptured[ThisIndex] = false; Delegate(sender, args); }  );
     
        Dragable.addEventListener("MouseLeftButtonDown", function( sender, args ) { sender.captureMouse(); IsCaptured[ThisIndex] = true; }  );
       
        Dragable.addEventListener("MouseMove", function( sender, args ) { if (IsCaptured[ThisIndex ]) { Dragable['Canvas.Left'] = args.getPosition(null).x; Dragable['Canvas.Top'] = args.getPosition(null).y; }  }  );
    }

    This function does all the magic for us and now drag and drop is one line of code.

     

  • Silverlight 1.1 Chatblender

    Check out this cool version of chat blender written in Silverlight 1.1 by our local Silverlight extrodenare and intern :) Devin.  This tool lets you put in some sample xaml and see it rendered.  Not such a big deal until you releaize that everyone that is logged in can see it...

    http://www.chatblender.com/ 

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