1 / 10

Resource File and Styling in SL

Resource File and Styling in SL. Mahender Senior Software Engineer United Health Group. Mahender Sarangam.

Download Presentation

Resource File and Styling in SL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Resource File and Styling in SL Mahender Senior Software Engineer United Health Group

  2. Mahender Sarangam • Having 5 years of experience on .NET Technologies. Working as a Senior Software Engineer in United Health Group (UHG India Information Service Ltd.). Worked with Big Firms like Deloitte Consulting & Wipro Technology. • Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. • MCTS Certified in Web Technologies. • Blog : http://Msarangam.wordpress.com

  3. What are Resource File • In Today Applications, resource places a important role in application development. Resource File may be any Images, Language specific RESX file, Audio, video • Reason for Resource Files • Reuse objects • Centralize details • Create non visual objects • In Silverlight, Resources can be managed in the following ways: • Loading on Demand • Resource embedded inside XAP/Assembly • Resources from external assemblies

  4. When we add Resource File to Silver Light Client project, How to deploy the resource file • With the help of Build Action property in Visual Studio , Mode of Deployment is decided • Marking BUILD Action as Resource, Content and None • When Build action is Resource ,Then Image file is embedded within Silverlight dll. Size of dll will be more. • When it is Content, Resource file will be part of XAP • When it is NONE, then we need to manually copy the resource file under ClientBin folder • Need to call resource from other silverlight library , we can refer like “/assemblyName;component/Location”

  5. Resources must be defined within an appropriately named collection called Resources. • This collection is a ResourceDictionary, a specialized dictionary containing resources identified by implicit or explicit keys • A merged resource dictionary enables you to declare the contents of a resource dictionary by referencing an external file, and to use the externally defined resources to augment the resources found in an existing FrameworkElement.Resources property location

  6. Styles are extremely important because they allow developers to control the look and layout of controls across their application. • This is a much faster alternative to updating each and every control in your application individually. • A style resource in Silverlight is a way to create reusable properties for various controls. • Styles in Silverlight are powerful mechanisms that allow controlling the visual representation of elements in a unified way /consistent look for all user interface elements. • Each Silverlight element has a series of attributes that you set to make a style for an element.

  7. Styles as a resource • You can declare it at User Control level where it is accessible to only the element on that User Control.  • You can define it at application level and have the style available to the whole application.  • You can also define the style in a resource dictionary and have that accessible to the whole application • Application Level Resources: Applies style to Global level i.e. at application Level. • Style customTextBlockStyle = Resources["StyledTextbox"] as Style;

  8. Cascading Styles: • you can build a powerful and reusable set of styles to apply in your Silverlight applications • <Style x:Key="LargerStyledTextbox" TargetType="TextBox" • BasedOn="{StaticResourceBlueStyledTextbox}"> • <Setter Property="FontSize" Value="25"/> • Merged Dictionaries

  9. <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="..." /> <ResourceDictionary Source="..." /> <ResourceDictionary Source="..." /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary></UserControl.Resources>

  10. Thank you

More Related