Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Resources and styles

1,198 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Resources and styles

  1. 1. Resource File and Styling in SL<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
  2. 2. Mahender Sarangam<br />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. <br />Got Technical Acquaintance on Technologies like C#, ASP.NET,AJAX, LINQ, Silverlight, WPF,WCF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. <br />MCTS Certified in Web Technologies.<br />Blog : http://Msarangam.wordpress.com <br />
  3. 3. What are Resource File <br />In Today Applications, resource places a important role in application development. Resource File may be any Images, Language specific RESX file, Audio, video<br />Reason for Resource Files<br />Reuse objects <br />Centralize details <br />Create non visual objects<br />In Silverlight, Resources can be managed in the following ways:<br />Loading on Demand <br />Resource embedded inside XAP/Assembly <br />Resources from external assemblies<br />
  4. 4. When we add Resource File to Silver Light Client project, How to deploy the resource file<br />With the help of Build Action property in Visual Studio , Mode of Deployment is decided<br />Marking BUILD Action as Resource, Content and None<br />When Build action is Resource ,Then Image file is embedded within Silverlight dll. Size of dll will be more.<br />When it is Content, Resource file will be part of XAP<br />When it is NONE, then we need to manually copy the resource file under ClientBin folder<br />Need to call resource from other silverlight library , we can refer like “/assemblyName;component/Location”<br />
  5. 5. Resources must be defined within an appropriately named collection called Resources. <br />This collection is a ResourceDictionary, a specialized dictionary containing resources identified by implicit or explicit keys<br />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<br />
  6. 6. Styles are extremely important because they allow developers to control the look and layout of controls across their application.<br />This is a much faster alternative to updating each and every control in your application individually.<br />A style resource in Silverlight is a way to create reusable properties for various controls.<br />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.<br />Each Silverlight element has a series of attributes that you set to make a style for an element.<br />
  7. 7. Styles as a resource<br />You can declare it at User Control level where it is accessible to only the element on that User Control.  <br />You can define it at application level and have the style available to the whole application.  <br />You can also define the style in a resource dictionary and have that accessible to the whole application<br />Application Level Resources: Applies style to Global level i.e. at application Level.<br />Style customTextBlockStyle = Resources["StyledTextbox"] as Style;<br />
  8. 8. Cascading Styles:<br />you can build a powerful and reusable set of styles to apply in your Silverlight applications<br /><Style x:Key="LargerStyledTextbox" TargetType="TextBox"<br />BasedOn="{StaticResourceBlueStyledTextbox}"><br /><Setter Property="FontSize" Value="25"/><br />Merged Dictionaries<br />
  9. 9. <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="..." /> <ResourceDictionary Source="..." /> <ResourceDictionary Source="..." /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary></UserControl.Resources><br />
  10. 10. Thank you<br />

×