This is a mirror of official site: http://jasper-net.blogspot.com/

Displaying Images in Silverlight 4 DataGrid using Converter

| Sunday, October 3, 2010
Silverlight 4 being a technology for Line-Of-Business (LOB) application has provided lots of features to developers. One of  them is implementing value converters. In a Proof Of Concept (POC) assignment recently, I came across a requirement for displaying images in Silverlight DataGrid. I used IValueConverter for this requirement. In this article, I have also used a WCF service which reads images from the Database and returns a Byte array. This service is consumed by the Silverlight application, where a converter is implemented.
Creating WCF service

In this task we will create a WCF service using VS2010 targeted for .NET 4.0 framework.
Step 1: Open VS2010 and create a blank solution, name it as ‘SILV4_Converters’. To this solution, add a WCF service and name it as ‘WCF4_ImageService’.
Step 2: Add the following interface and the DataContract class in ‘IService1.cs’:
C#
using System.Runtime.Serialization;
using System.ServiceModel;

Namespace WCF4_ImageService
{
   [ServiceContract]
   Public Interface IService
   {
       [OperationContract]
       ImageEmployee[] GetAllEmp();
   }

   [DataContract]
   Public Class ImageEmployee
   {
       [DataMember]
       public int EmpNo { get; set; }
       [DataMember]
       public string EmpName { get; set; }

Read more: dot net curry.com

Posted via email from .NET Info

0 comments: