Home : Silverlight UI Components : Rating1

Rating Silverlight Component

Summary: Rate anything with this versatile component. Allow change in ratings or simply show current rating. Limit number of times rating can be saved. Fully customizable. Sample code provided.
Example 1: Default style
View XML configuration file
Example 2: Styled, updatable, initial value set to 2 stars, limit to 5 submits
View XML configuration file
Example 3: Styled, not updatable, 4 stars
View XML configuration file
Add this component in 4 easy steps
  1. Download XAP file and place it in /ClientBin folder of your web project:
    Download XAP File
  2. Download XML configuration file and add it to your web project (right click, select 'Save Target As'):
    Download Configuration File
  3. Add HTML code below to your web page:
  4. Add new Web Page, name it Service.aspx. Add code to process posted data from users. Sample code: C#
    Download Code
  5. Customize your component by changing values in XML configuration file:
    • Width - defines width of the control. Default: 130
    • Height - defines height of the control. Default: 24
    • Backgroundcolor - defines background color of the control in RGB format. Default: 255.255.255 (white)
    • Updatable - defines if rating can be changed. Values: Yes, No. Default: Yes
    • InitialValue - sets initial rating (highlighted stars). Values: 0 to 5. Default: 0
    • MaximumSubmits - defines limit on number of successful submits. Maximum value: 50. Default: 1
    • BottomLayerBorderColor - defines border color of unselected star in RGB format. Default: 150.150.150 (gray)
    • BottomLayerBackgroundColor - defines background color of unselected star in RGB format. Default: 255.255.255 (white)
    • BottomLayerBorderThickness - defines border thickness of unselected star. Values: 0 to 20. Default: 1
    • TopLayerBorderColor - defines border color of selected star in RGB format. Default: 0.30.175 (dark blue)
    • TopLayerBackgroundColor - defines background color of selected star in RGB format. Default: 0.78.255 (blue)
    • TopLayerBorderThickness - defines border thickness of selected star. Values: 0 to 20. Default: 1
    • SaveDataTo - defines URL where data will be sent in XML format (POST method). No Default value.
      Sample code C# to read posted data on web server.
    • Key - any value that represent id of an item to be rated. When user provides rating, Key value is sent to the web server along with number representing number of stars. Possible values can be product id, image id, page id, etc. Default: empty
Other info:
  • Values for initParams parameter of Silverlight object:
    • configuration - optional. Name of XML file that defines visual presentation and behavior
    • configuration. - optional. Alternate to XML configuration, all settings can be specified as part of initParams parameter. Example: ...,configuration.width=100,configuration.height=200,...
  • For windowless mode, add additional parameter to Silverlight control.
    Sample: < param name="windowless" value ="true"/>
    For more information read MSDN article
  • If Silverlight component is not displayed properly after application was moved to test or production servers, ensure proper MIME settings on your web server. For more information search "XAP Mime type in IIS" with your favorite search engine
Home  ∴  Labs  ∴  Contact