.NET Blog

Tony Cavaliere

 
My Favourite Albums
  And the Grappa wins.
E-mail me Send mail
Add to Technorati Favorites AddThis Feed Button

Subscribe to Cynot Why Not


Recent posts

Disclaimer

Hey unlike other bloggers I stand by what I say but just in case. The opinions expressed herein are my own except on Tuesday when the second card is not turned up otherwise it ain't worth squat.

© Copyright 2010

Fun with Silverlight and jQuery

Microsoft recently announced that it will be shipping jQuery with Visual Studio. This is remarkable announcement since they did not acquire jQuery and will not be creating there own version of jQuery but rather they will be including jQuery as is and will provide 24/7 support for the product. In addition MS will be making regular contributions to the jQuery library following the same rules as everyone else contributing to jQuery.

The jQuery site already has a link to where you can download the jquery-1.2.6-vsdoc.js. This file contains includes the XML comments that when included will provide rich intellisense for jQuery. That's right intellisense support for jQuery in VS2008. Download jQuery intellisense file from this site. Just select the Visual Studio link.

jQuery's core API is extremely powerful providing excellent selector capabilities, simplifying HTML documentation traversing. jQuery also simplifies event handling, animating and Ajax interactions. Lately, I've been playing around with jQuery Plugins and wow. There are currently 1000+ plugins available at the jQuery site.

As an exercise I thought it would fun to write a Silverlight application and incorporate some jQuery. I decided to use the Drag and Drop plugin called $.event.special.drag. How well would this  plugin work with Silverllight? Let's find out.

Implementing dragging using this plugin is simple, just create a div tag and then call the Javascript API passing the div tag. The following  shows how to implement dragging. I've embedded a Silverlight control within the div tag.  

    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

    2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">

    3 

    4   <head>

    5     <title>Drag with jQuery</title>

    6     <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    7     <meta http-equiv="imagetoolbar" content="no" />

    8 

    9     <style type="text/css" media="screen">

   10         body {

   11           font: 12px/16px Verdana, Arial, Helvetica, sans-serif;

   12           color: #002;

   13           padding: 0;

   14           margin: 12px;

   15         }

   16         .silverlight {

   17           position: absolute;

   18           left: 10px;

   19           top: 10px;

   20           height: 500px;

   21           width: 700px;

   22           background: #CCF;

   23           border: 1px solid #AAD;

   24           text-align: center;

   25           font-size: 14px;

   26         }

   27         .sloverlay {

   28           height: 500px;

   29           width: 700px;

   30           text-align: center;

   31           font-size: 14px;

   32           float: left;

   33         }

   34         .stuff {

   35           height: 100px;

   36           width: 200px;

   37           background: #777777;

   38           float: left;

   39           margin-left: 10px;

   40         }

   41         .title {

   42           cursor: move;

   43           background: #AAD;

   44           height: 20px;

   45         }

   46     </style>

   47 

   48     <script src="jquery.js" type="text/javascript"></script>

   49     <script src="jquery.event.drag.js" type="text/javascript"></script>

   50 

   51     <script type="text/javascript">

   52       //

   53       $(document).ready(function(){

   54           $('#silverlight')

   55             .bind('dragstart', function(event) {

   56             return $(event.target).is('.title');

   57           })

   58             .bind('drag', function(event) {

   59             $(this).css({

   60               top: event.offsetY,

   61               left: event.offsetX

   62             });

   63           });

   64       });

   65     </script>

   66 

   67   </head>

   68 

   69   <body>

   70     <div class="sloverlay"></div>

   71     <div class="stuff"></div>

   72     <div id="silverlight" class="silverlight">

   73       <div class="title">You can drag this entire window.</div>

   74         <object data="data:application/x-silverlight,"

   75           type="application/x-silverlight-2"

   76           width="100%" height="485px">

   77           <param name="source" value="ClientBin/DragAndDrop.xap"/>

   78           <param name="background" value="white" />

   79           <a href="http://go.microsoft.com/fwlink/?LinkID=115261"

   80             style="text-decoration: none;">

   81               <img src="http://go.microsoft.com/fwlink/?LinkId=108181"

   82               alt="Get Microsoft Silverlight"

   83               style="border-style: none"/>

   84           </a>

   85         </object>

   86         <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>

   87     </div>

   88   </body>

   89 

   90 </html>

You can check out this application in action by navigating to this site. Try dragging the window that contains the Silverlight control. Just hover over the title, press the left mouse button and move the window to a new location. This all worked without any complications. 

Guess the movie

I have no armour left. You've stripped it from me. Whatever is left of me - whatever is left of me - whatever I am - I'm yours.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Silverlight
Posted by CynotWhyNot on Wednesday, November 05, 2008 10:17 AM
Permalink | Comments (17) | Post RSSRSS comment feed

Related posts

Comments

busby seo test us

Tuesday, January 13, 2009 1:25 AM

busby seo test

thanks for the info!!excellent blog you wanted

answerspluto.com

Monday, July 13, 2009 3:39 PM

pingback

Pingback from answerspluto.com

list of urls 4 « Answers Pluto

all natural skin care products us

Thursday, September 10, 2009 6:11 AM

all natural skin care products

I loved the way you exlained things. Much better many here


Regards

Nimi

ways to pass a drug test us

Friday, September 11, 2009 5:32 AM

ways to pass a drug test

Now this is hghly recommeded post for me. I will surely email this to my friend.


Regards

Loop

payday loans us

Monday, September 14, 2009 12:39 AM

payday loans

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.Any way Ill be subscribing to your feed and I hope you post again soon

Arabic Translation Service us

Monday, September 14, 2009 3:35 AM

Arabic Translation Service

I posted your article to my myspace profile.


Regards

Cruz

payday online us

Monday, September 14, 2009 11:24 AM

payday online

I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.

payday loans us

Monday, September 21, 2009 2:22 AM

payday loans

We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

Watch House Online us

Tuesday, November 17, 2009 5:14 AM

Watch House Online

Well this is very interesting indeed.Would love to read a little more of this. Great post. Thanks for the heads-up�This blog was very informative and knowledgeable



Regards
Natl

Technical Translations us

Wednesday, November 18, 2009 1:26 AM

Technical Translations

Well this is very interesting indeed.Would love to read a little more of this. Great post. Thanks for the heads-up�This blog was very informative and knowledgeable



Regards
Natl

discount designer handbags sale US

Tuesday, December 01, 2009 5:42 PM

discount designer handbags sale

Your blog seems interesting.Regards,Kevin.

lexus dealers ny us

Tuesday, December 08, 2009 5:24 AM

lexus dealers ny

Hi webmaster, commenters and everybody else !!! The blog was absolutely fantastic! Lots of great information and inspiration, both of which we all need!b Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!



Regards and respect
Cello


Landscaping Company Raleigh us

Sunday, December 13, 2009 11:50 AM

Landscaping Company Raleigh

I loved the way you exlained things. Much better many here


Regards
Kristina

car lease deals us

Friday, December 18, 2009 6:47 AM

car lease deals

Thank you very much for the information provided! I was looking for this data for a long time, bit I was not able to find the trusted source

Regards
Simpson

winner sneaker US

Thursday, December 24, 2009 3:46 PM

winner sneaker

Yeah, you are right, I agree with you.

discount designer handbags US

Wednesday, December 30, 2009 6:48 AM

discount designer handbags

If you need to buy discount gucci bags, you can just type bagsvendor.com in you browser address line and find out the gucci bags on big sale in discounted price. The information below is only introducing the discount news about gucci bags and gucci handbags. A woman leads the world accounting her gucci bag. But then we must also remember that there is a well discount news that has to see. It is a common complaint that women having their share is not large enough to hold all your belongings necessary, such as discount gucci bags, designer bags. This gucci bags you can find in bagsvendor.com is that the person is unable to organize things properly. Each discount bag has a clear purpose and objects you choose to take the bag must be compatible with the purposes for which it is purchased in your mind. We can meet the wide range of needs that are part of the common things for a trip on a beautiful handbag, bags or purses. Thus, while the discounted gucci bags needs, here are some points that may be useful to organize the contents of the discount gucci bag. Even it is a discounted price gucci bags, but it has high quality. The quality of materials used with the gucci bag is leather, suede or cotton. These materials can be sure that they are not less than 100% authentic and of excellent quality discount bags. Accessories and decorative items from the discount gucci bag, such as hinges, chains, rings and belt buckles are higher that other bags. Some designers in the Gucci company will even give as a repair or replacement free of charge in a period of time to ensure that their discount handbags are offered in a different league than the shares that you can find at any mall or online store. Designer Gucci bags can be changed to discounted gucci bags. This is a big news about handbags on sale. Brands are just called by many famous fashion people, and can be done with any discounted news. Just find more in bagsvendor.com

air jordan US

Friday, January 01, 2010 2:45 AM

air jordan

In winnersneaker, these Nike Air Jordan shoes were associated with sport, fashion and basketball. The Nike Air Jordan sneakers were a way to hide some of the smaller sizes, or raise an important NBA star to even higher levels to the count. Nike Air Jordan shoes, but also less fashionable of Air Jordan history. Which were commonly used by high-ranking customers in NBA during the 19th century and were used in the 20th century to let the putrid mud in the streets, all you know is that you can find many discounted Air Jordan shoes in winnersneaker.com. Existing Air Jordan retro sneakers in the United States and Europe retails do not feel in fashion until the new Air Jordan shoes come in the street. At first the Air Jordan 1 shoes important wearing for young sport men, but once reigned basketball, Jordan shoes became the must-have fashion accessory for young people in the basketball playground. These Air Jordan original shoes were all to make a statement vividly. Air Jordans like Air Jordan 23 and Air Jordan 6 wore basketball shoes kiss in the context of his people larger than life. Wish you find a suitable Air Jordan shoes in winnersneaker.com.

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Tuesday, February 09, 2010 6:49 AM