Showing posts with label silverlight. Show all posts
Showing posts with label silverlight. Show all posts

Friday, September 10, 2010

How many type of Styles in SilverLight

A Style is a collection of property values that you can apply to an element in one step. A style allows us to encapsulate control property values as a reusable resource. Silverlight supports only explicit styles. Styles are similar to CSS (Cascading Style Sheet) standard in HTML markup. We can set different properties for an element and store it in a name and then we can re-use it in our application. Before going to create a style, we should decide where to put it. We can store the Style in Resource property of a Control.

Every Style Element requires a Key, so that we can refer it anywhere using their Key. It supports only named types. It requires TargetType, which is the type of an element on which you r applying a style.

There are three ways to use Styles:

1. You can apply styles to particular page.
2. You can apply styles to particular Control.
3. You can apply styles globally.

Let us see all the steps one by one.

1. Applying Styles to a particular page:

Defining:

First we need to define the style in UserControl.Resource section like,

1.gif

A Setter element is a definition of one property to set on the target object. A Setter has a two Property one is Property naming the property to set on the target and another one is Value property defining the value to set on the property.

Here is your Page.xaml code:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">





Applying:

Then you can apply the style which you have created using the Style property of a Button as shown in the below code.

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">









3. Applying Styles Globally:

To use the Styles globally, i.e., you can use the Styles in any xaml pages throughout your application, for that you need to define the Style in Application.Resource in App.xaml file.

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="styling.App">






Here is your xaml file.

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">



Read More

Friday, October 10, 2008

Silverlight

Microsoft Silverlight is a programmable web browser plugin that enables features such as animation, vector graphics and audio-video playback that characterize rich internet applications. Silverlight competes with products such as Adobe Flash, Adobe Flex, Adobe Shockwave, JavaFX, Curl and the JavaScript programming language. Version 2.0, now in beta-testing, brings additional interactivity features and support for .NET languages and development tools.Silverlight was developed under the codename Windows Presentation Foundation/Everywhere (WPF/E). It is compatible with multiple web browser products used on Microsoft Windows and Mac OS X operating systems. Mobile devices, starting with Windows Mobile 6 and Symbian (Series 60) phones, will also be supported. A third-party free software implementation named Moonlight is under development to bring compatible functionality to GNU/Linux.
Silverlight 1.0
A Silverlight 1.0 application hosted in Internet Explorer. Interactivity is provided by Silverlight, but user input controls are HTML controls overlaid on top of Silverlight contentSilverlight 1.0 consists of the core presentation framework, which is responsible for UI, interactivity and user input, basic UI controls, graphics and animation, media playback, Digital rights management, and DOM integration. It is made up of the following components:Input – handling input from devices like keyboard, mouse, stylus etc.UI core – managing rendering of bitmap images (including compressed raster images like JPEG), vector graphics, text and animations.Media – playback of MP3, WMA Standard, WMV7, WMV8 and WMV9/VC-1 streams.XAML – to allow the UI layout to be created using XAML markup language.A Silverlight application starts by invoking the Silverlight control from the HTML page, which then loads up a XAML file. The XAML file contains a Canvas object, which acts as placeholder for other elements. Silverlight provides various geometrical primitives like lines, ellipses and other shapes, to elements like text, images, and media etc. The elements are properly positioned to achieve the desired layout. Any arbitrary shape can be created as well. These elements can be animated using Event triggers; some animation effects are predefined, others can be created as composite of the pre-defined effects. Events like keyboard or mouse movements can also raise Events which can be handled by custom scripts
Read More
Powered By Blogger · Designed By Seo Blogger Templates