SilverlightExamples.NET

Latest Silverlight Samples, Examples, Demos and Tutorials.

Load Bitmap Image From Resource in a Single Line of Code

clock April 8, 2008 15:42 by author Neo

If you read my recent article "How to Get Files From Resources in Silverlight 2.0", you'll see that loading a file embedded as resource takes only a few lines of code. You also have to remember the formats of the URI. Well, that is going to change today, because now you'll need to write just a single line of developer-friendly code.More...

Currently rated 3.5 by 2 people

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


How to Get Files From Resources in Silverlight 2.0

clock April 7, 2008 03:14 by author Neo

Questions like "How to load an embedded bitmap programmatically?" appear in Silverlight.net forum every single day, and some people actually think it is impossible to do such thing in Silverlight 2.0. Well, the truth is that not only is it possible but it is also damn easy.More...

Currently rated 5.0 by 2 people

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


VectorLight Controls for Silverlight 2.0 Beta 1

clock April 4, 2008 13:43 by author Neo

 

 

I think the competition in Silverlight Controls market will be fierce. Just under a few months, developers have created a handful of UI controls for Silverlight 2.0 already. Well, some like VectorLight provides it for free with full source code (maybe for now?). The VectorLight's controls set include Calendar, Dropdown List, Fieldset, ListBox, Textbox, TextArea, Tree View, Progress Bar, and Text Label.

VectorLight Controls Demo 

Be the first to rate this post

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


Restrictions of Sockets in Silverlight 2.0 Beta 1

clock March 5, 2008 05:41 by author Neo

As expected, Silverlight 2.0 Beta 1 was released hours ago, and it comes with Socket Networking support. Silverlight applications can now make direct/persistent connections to remote server. There are however some restrictions:

  • Supports only TCP.
  • Connect to only site or host of origin. (Temporary restriction until future release of Silverlight 2.0)
  • Connect to only port range of 4502-4532.
Maybe there are some more. It is a bit early to list them all here.

Currently rated 4.0 by 1 people

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


Nokia Phones to Run Silverlight Applications

clock March 5, 2008 04:39 by author Neo
Espoo, Finland - Nokia today announced plans to make Microsoft Silverlight available for S60 on Symbian OS, the world's leading smartphone software(1), as well as for Series 40 devices and Nokia Internet tablets.  Adding support for Silverlight will extend opportunities for developers to create rich, interactive applications that run on multiple platforms in a consistent and reliable way.
 
"Today's consumers are very clear in what they want: easy access to tightly integrated services and data on any device," said Lee Williams, Senior Vice President in Nokia's Devices software organization. "Nokia's software strategy is based on cross-platform development environments, enabling the creation of rich applications across the Nokia device range.  Nokia aims to support market leading and content rich internet application environments and to embrace and encourage open innovation. By working with Microsoft, we are creating terrific opportunities and additional choices for the development community, S60 licensees and the industry as a whole."
 
More...

Currently rated 5.0 by 1 people

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


Silverlight 2.0 Beta 1 Is Available For Download

clock March 5, 2008 04:39 by author Neo

Like I told you guys over the past few weeks, Silverlight 2.0 Beta 1 was to be released on March 05. Yes, confirmed! Silverlight 2.0 Beta 1.0 run-time binaries, SDK, source code and documentation are now available for download. Thanks to coolio for his compilation of links.

If you're developing Silverlight applications in Visual Studio 2008, you should download Silverlight Tools Beta 1 for VS2008 and Expression Blend 2.5 March Preview.

Microsoft Silverlight Tools Beta 1 for Visual Studio 2008 (This package contains VS2008 add-on, run-time binaries,  SDK, documentation and samples)
http://www.microsoft.com/downloads/details.aspx?FamilyID=e0bae58e-9c0b-4090-a1db-f134d9f095fd&DisplayLang=en

Expression Blend 2.5 March Preview:
http://www.microsoft.com/downloads/details.aspx?FamilyID=32a3e916-e681-4955-bc9f-cfba49273c7c&DisplayLang=en 

SDK:
http://www.microsoft.com/downloads/details.aspx?FamilyID=4e03409a-77f3-413f-b108-1243c243c4fe&DisplayLang=en

Silverlight 2 Beta 1 runtime for Windows:
http://silverlight.dlservice.microsoft.com/download/6/6/3/663404e9-990d-4b74-873c-c4611aea2133/Silverlight.2.0.exe

Silverlight 2 Beta 1 runtime for Mac OS X:
http://www.microsoft.com/Silverlight/handlers/getSilverlight.ashx?v=2.0&targetplatform=macintel

Controls Source Code:
http://www.microsoft.com/downloads/details.aspx?FamilyID=ea93dd89-3af2-4acb-9cf4-bfe01b3f02d4&DisplayLang=en

Documentation:
http://www.microsoft.com/downloads/details.aspx?FamilyID=1840cab5-196c-4264-b55d-562242a72625&DisplayLang=en  

Online documentation:
http://msdn2.microsoft.com/en-us/library/bb404700.aspx 

Notes

Silverlight 2.0 Beta 1 is not compatible with Silverlight 1.1. Therefore, you might have to uninstall the following components first before installing that of Silverlight 2.0 Beta 1:

  • Previous version of Silverlight runtime.
  • Previous version of Silverlight SDK.
  • Previous version of Silverlight Tools for Visual Studio.
  • Visual Studio Update KB949325

Enjoys!

Currently rated 5.0 by 3 people

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


Expression Blend March Preview to be released with Silverlight 2 Beta 1

clock February 28, 2008 21:50 by author Neo

Scott Guthrie just blogged about the Expression Blend 2.5 March Preview minutes ago. Expression Blend 2.5, which adds support for new Silverlight controls, is to be released as a free preview at the same time Silverlight 2 Beta 1 goes public. You should take a take look at his blog post for details.

Be the first to rate this post

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


Silverlight 2.0 will support Socket and Cross-Domain Networking

clock February 23, 2008 13:03 by author Neo

In case you missed the recent Scott Guthrie's blog post on Silverlight 2.0, there are going to be some cool developments in Silverlight 2.0 Beta1, which is to be released before March 05 2008. I like the fact that direct socket networking is supported. Better yet, cross-domain access is also supported. These two features alone will allow Silverlight developers to create rich Client-Server applications. Basically, a Silverlight 2.0 application will get the privileges of what a desktop application has, in terms of networking. Creating live chatting application in Silverlight is now possible, so are stock trading terminal, remote desktop client, multi-player game, grid computing client,  FTP client, streaming real-time chart, etc. With the help of new 'local storage' support, creating a full-featured BitTorrent P2P client might be a reality. And yes, those new built-in controls will help us create UI applications much quicker. Isn't this super exciting? 

Scott mentioned many other things:More...

Be the first to rate this post

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


Silverlight Libraries Source Code Will Be Available

clock January 21, 2008 18:39 by author Neo

On January 17 2008, Scott Guthrie announced the availability of .NET Framework Source Code under read-only reference for debugging purposes. That was great news indeed for .NET developers especially for those who had used .NET Reflector. This will solve a lot of debugging mysteries behind the "[External Code]" in the call stack. But hold on a sec, there is greater news for Silverlight developers, the source code of Silverlight libraries will be available as well according to his reply to our comment. I asked him if Silverlight source code could be opened. "Yes - we'll be releasing the source and enabling debugging for the Silverlight libraries as well once they ship." he replied. Although his reply is not an official announcement, it significantly leverages the possibility of having Silverlight source released.More...

Currently rated 5.0 by 1 people

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


Open File Dialog in Silverlight

clock January 18, 2008 02:40 by author Neo

Silverlight 2.0 Alpha introduced OpenFileDialog control which allows Silverlight applications to open and read *local* files outside Isolated Storage. It's better than the HTML <input> tag which is widely used for uploading files in web page. Well, like HTML <input>, OpenFileDialog could be used to build a file uploader quickly. Both must prompt user to select files. But unlike HTML <input>, OpenFileDialog control could be used to read and process the file data locally in Silverlight application. This is pretty powerful since Silverlight application will not need to upload the files to server for processing. What's more is that OpenFileDialog allows user to select multiple files at once. No need to create multiple instances of OpenFileDialog for that. Let's see some examples:More...

Currently rated 3.7 by 3 people

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


Fluid Canvas in Silverlight

clock January 17, 2008 06:37 by author Neo

So you wanted the root canvas to scale proportionately to the host element to achieve fluid layout, and you tried setting Width=”100%” or Height=”50%”, but then horror struck because of this parser error: “Invalid attribute value 100% for property Width/Height”.  Ok, to tell you the truth you cannot set “%” to the Width and Height properties because the % is not accepted. Read on for the solution.

The BrowserHost instance has the Resize() event which fires every time the host element is resized and the ActualWidth/ActualHeight properties which tells the dimension of the host element. So, to automatically resize the root canvas, handles the BrowserHost.Resize() event, and from there you can resize the canvas. Let’s sum it up with VB.NET and C# code:More...

Currently rated 4.0 by 1 people

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


Creating Cool Draggable Window in Silverlight

clock January 13, 2008 22:23 by author Neo

 
 

Silverlight is often dubbed as the would-be better platform for creating Rich Internet Applications. But to date, I’ve seen only applications sitting duck in the browser. Well, I’m not saying that those are not great RIA, but for goodness sake, I want to see something different like a Silverlight application flying around in the browser among HTML elements, or at least a window in Silverlight that could be dragged around. This motivates me to create a proof of concept.

This tutorial basically demonstrates how to create and overlay a draggable window on HTML body in Silverlight 1.1, using managed code and DOM. For simplicity, this sample uses an alpha-blended background PNG image to cast the shadows and make the ‘see-through glass’ effect on the LCD screen.More...

Currently rated 4.6 by 5 people

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


Silverlight Can Go Full Screen and Back

clock January 12, 2008 01:29 by author Neo

So you want your Silverlight video player to play in full screen? No problem! It's pretty easy to go into full screen mode, hiding everything including browser frame, in Silverlight. It's just a line of code:

Application.Host.Content.IsFullScreen = True 

While in full screen mode, user can press ESC key to exit full-screen mode, or your Silverlight application can exit programatically by:

Application.Host.Content.IsFullScreen = False

You can easily toggle between full screen modes by:

VB.NET
Application.Host.Content.IsFullScreen = Not Application.Host.Content.IsFullScreen

C#
Application.Host.Content.IsFullScreen != Application.Host.Content.IsFullScreen;

The Content class exposes two events FullScreenChanged() which fires when the full screen mode is changed, and Resized() event which fires when the host element is resized (not when browser is resized). You can use these events to detect when user gets into and out of full screen mode. It's also worth mentioning that all keyboard events will not fire in full screen mode, only mouse events will. This feature is to protect user from password spoofing and other impersonation attacks.

View Online Demo - Download Source Code (14.34 kb)

Currently rated 5.0 by 1 people

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


Silverlight To Light Up Olympics 2008

clock January 10, 2008 09:08 by author Neo

Folks, the Olympics 2008 Games in Beijing, China is coming soon on 08/08/08. Sports aside, the most exciting news to me is in fact the deal between Microsoft and NBC to broadcast the Olympics games over the web via Silverlight 2.0. Over 3000 hours of live and on-demand videos will be available exclusively to anyone with Silverlight 2.0 plug-in installed. In layman's terms, you can watch every second of all the games if you have Silverlight 2.0. For more details, read the blog post by Soma Segar, corporate vice president of the Microsoft Developer Division.

Now let's talk business. Thousands if not millions of people will download and install Silverlight 2.0 plugin. This will definitely bring the "98% of web users can run Flash Silverlight applications" closer to reality. We Silverlight developers would be able to deploy our Java Silverlight applications worry-free over the web, because 98% of all web users could use them right away. And Microsoft might not have to deal with antitrust lawsuits, because they wouldn't need to distribute Silverlight in the automatic Windows Update.

I'll definitely keep an eye on NBCOlympics.com for videos of the Olympics.

Currently rated 5.0 by 2 people

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


Store and Read Files in Client's Computer Using Isolated Storage

clock January 10, 2008 01:49 by author Neo

Says your application downloads some data files and need to save them locally in the client's computer for subsequent uses. Well, Silverlight in partial-trust mode cannot access client's file system directly, because that would seriously compromise the client's computer. So, Silverlight team devised an ingenious solution by creating a sandboxed virtual file system as known as Isolated Storage. As the name implies, each Silverlight application is given an isolated storage for its own use, up to about 1MB in Silverlight 1.1 Alpha. This opens up a lot of good possibilities like saving user settings, temporary files, form inputs, etc. Without further ado, let's see how to save a text file:More...

Be the first to rate this post

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


How to Get Information About Browser, Web Page and Cookies

clock January 10, 2008 00:45 by author Neo

 

As Silverlight application is hosted in web browser, you might somehow want to get some information about it like browser name, version, platform or user agent. Or you might want to check whether cookies are enabled before reading/writing them. It's pretty easy indeed, because Silverlight exposes the references to the browser and page instances in System.Windows.Browser namespace. They're all there. HtmlPage holds the information of the current web page, and BrowserInformation holds that of the browser. Here's a quick example of how to get the name of the browser:More...

Currently rated 4.5 by 2 people

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


Execute Code String at Runtime with Silverlight 2.0 DLR

clock January 4, 2008 03:40 by author Neo

Requisites

  • Microsoft Visual Studio 2008
  • Silverlight 1.1 Alpha November Refresh or Newer

Introduction

One of the best additions in Silverlight 2.0 is the implementation of the Common Language Runtime and then the Dynamic Language Runtime, both of which were missing in Silverlight 1.0. Let’s dig a bit deeper in this CLR and DLR thing.

Silverlight 2.0 CLR is a stripped down version of .NET Framework 3.5 featuring the same type system, JIT compiler, garbage collector and a shipload of the same .NET 3.5 namespaces. Silverlight CLR allows .NET code to execute in a sandboxed environment on the client-side. But here’s the problem: Full .NET Framework has the full implementation of System.CodeDom framework which allows .NET code compilation at runtime, but Silverlight CLR strips out 99% of System.CodeDom namespace for security and space concerns. Therefore, you can no longer compile .NET code through the CodeDom in Silverlight. This is when DLR comes to rescue!More...

Be the first to rate this post

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


Farseer 2D Physics Engine For Silverlight and XNA

clock December 31, 2007 07:30 by author Neo

 

The Farseer Physics Engine is an open-sourced 2D physics engine designed for Microsoft’s XNA and Silverlight platforms. The Farseer Physics Engine focuses on simplicity, useful features, and enabling the creation of fun, dynamic games.

Demos 

You'll find more samples in its SDK download. More...

Currently rated 5.0 by 1 people

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


Silverlight 8-Ball Game

clock December 30, 2007 21:11 by author Neo

Enjoy the smooth play in this classic two-player 8-Ball Billiards game, thanks to Justin Petersen from Clarity Consulting. Use your mouse to control the pool cue’s direction and power, as well as ball-in-hand Q-Ball placement after a scratch. For developers, you'll get to lean how force, motion and collision detection is done in Silverlight.

Play Online - C# and VB.NET Source Code 

Be the first to rate this post

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


Pop The Balloons!

clock December 30, 2007 21:04 by author Neo

Balloons is a simple game by Pete Brown demonstrating simple animation and dynamic UserControls in full-screen. "I wrote this to amuse my toddler and have managed to amuse a number of developers with it." Pete.

Online Demo - Source Code

Be the first to rate this post

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


Search

Calendar

<<  May 2008  >>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Archive

Tags

Categories


Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in