Extending User Control in Silverlight 2 Beta 2

July 1, 2008 at 5:36 am | Posted in Silverlight 2 | Leave a comment
Tags: , , ,

There is a breaking change in Beta 2 for the way user control inheritance is implemented. In Beta 1 if you have created a base class which you want to extend in other pages it is done simply replacing the base class name with “<UserControl …. “ tag as “<BaseClass …”.
But this does not work in Beta 2. To solve this problem you need declare the namespace of your library and then include it as it was done in case of including in custom controls.

Suppose my base class is BaseRnd, which is just inheriting the UserControl class

namespace RnD
{
    public class BaseRnd : UserControl
    {      
   
}
}

Child Class inheriting the BaseRnd
namespace RnD
{
    public partial class TestPage : BaseRnd
    {
        public TestPage()
        {
            InitializeComponent();            
        }       
    }
}

<myBase:BaseRnd x:Class=”RnD.TestPage”
    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation 
    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml 
    xmlns:myBase=”clr-namespace:RnD
    Width=”400″ Height=”300″>

 

Change the closing tag as well.
Do this and it will start working
J

Check out my site www.silverlightchannel.com, just started adding some articles.

Isolated Storage Silverlight 2

June 29, 2008 at 8:27 am | Posted in Silverlight 2 | Leave a comment
Tags: ,

 What is Isolated Storage
Isolated storage is a data storage mechanism that helps in storing some data on the client machine. With isolated storage, data is always isolated by user and by assembly. Credentials such as the origin or the strong name of the assembly determine assembly identity. Data can also be isolated by application domain, using similar credentials. Using isolated storage enables partially trusted applications to store data in a manner that is controlled by the computer’s security policy. This is especially useful for Web applications and downloaded components that a user might want to run cautiously. Security policy rarely grants this kind of code permission to access the file system using standard I/O mechanisms, but, by default, code running from the local computer, a local network, or the Internet is granted the right to use isolated storage.
Non-Volatile Storage
Silverlight 2 has changed the implementation of Isolated Storage and has made it a non volatile cache, which means that whatever is saved as isolated storage will not be cleared when user clears the browser cache. The files are stored independently of browser cache, which is shared across the browsers and easily maintained by the application code. It can anytime be removed by user or by application.
Location of Isolated Storage in Vista
%:\Users\%\AppData\LocalLow\Microsoft\Silverlight\is
Location of Isolated Storage in Windows XP
%:\Documents and Settings\%\Local Settings\Application Data\Microsoft\Silverlight\is

Isolated Storage Quota limit in Silverlight 2
The default limit for isolated storage in Silverlight 2 is given as 100 kb. It’s much much lesser than the default storage limit given in Silverlight 1.1 which is 1 mb.
This limit of 100 kb can be increased to unlimited storage, but this can only be done with consent of the user accessing the application. So whenever the application requires more than 100 kb of space, an alert will be generated and user need to accept it for increasing the size.

Full article with source code is available here

State Management in Silverlight 2

June 29, 2008 at 8:25 am | Posted in Silverlight 2 | Leave a comment
Tags: ,

In Asp.net the state management was used to be done either in client side which included the cookies, hidden fields, viewstate and query strings object or in server side which included the Application object, session object and other custom way for handling it.
The architecture of Silverlight 2 and its implementation totally differs from the architecture of asp.net. In Silverlight 2 everything is compiled and packaged into XAP files, which get copied on to the client machine whenever the person access the Silverlight based web site. So there are no server round trips and page request every time, so there are not much need of maintaining the state of the user or application.Anyway there are times when it is required to have some sort of state management mostly in business applications. State management in Silverlight 2 is typically done using the concept of Isolated storage.

Silverlight State Management using Isolated Storage
I have done the POC on State management using the Silverlight Isolated storage. The application uses the XML serialization to send and store data at the virtual place at the client machine.

State Management Demo
It stores some of the information about the User. The “Get Saved State” button retrieves the existing user values from the Isolated Storage area and “Save State” picks the data from all the text boxes and saves it.

Full article with source code is available “here”

Silverlight 2.0 latest from Microsoft

June 16, 2008 at 11:50 am | Posted in Silverlight 2 | Leave a comment
Tags: , , , , ,

Little Silverlight Overview

Cool Silverlight is a cross browser-platform language (XAML) from Microsoft. It’s a part of hottest technologies included in Framework 3.5. Silverlight is a great initiative from Microsoft giving a great tool for building next generation rich user interactive applications.

Note
There are currently two version in Silverlight, Silverlight 1.x and Silverlight 2. I would suggest that you learn and develop applications in Silverlight 2, as it includes plethora of new features, better style and support for programming.

Some of the features of Silverlight, that I like the most includes:

Cross Browser – Cross Platform
Since everything is encapsulated in a XAP file and all the runtimes are included in the Silverlight plugin, this really makes the Silverlight based applications browser and platform independent.

No Page Round Trips

 


Though Silverlight is tightly integrated within a browser but it does not works like the way older language based applications used to work. Other than the AJAX based implementation, every request on the web page needs to be furnished from the server, causing a whole page to refresh and giving not so good experience to the user.

 Silverlight 2.0 encapsulates everything in the XAP file (XAP files are packaged file that comprise all the application compiled code, it also includes the code for various other assembly references used in the application), which gets cached on the browser cache. This includes all the compiled code which earlie used to reside on the server. 

Rich Controls
Silverlight 2 includes many rich controls like (Textbox, listbox, check box, radio buttons etc) and controls for layout manager Grid Panel, Canvas and Stack Panel.

Missing Control
One of the important control that is missing in Silverlight 2 is combo box control. But cheers, soon I will be writing the custom control for providing the functionality of combo box control.

Silverlight Architecture
Check out this link on the MSDN to learn more about the Silverlight Architecture and the cool stuff you can do with it J .. enjoy learning
http://msdn.microsoft.com/en-us/library/bb404713(VS.95).aspx

 Silverlight 2 Beta 2
Anyway I was intended to write more about the S2 beta 2 but just thought to give little overview about silverlight2.  Read more about it “here”.

You can download the latest version Silverlight 2 Beta 2 from here.

Blog at WordPress.com.
Entries and comments feeds.