Windows Scripting
  Home arrow Windows Scripting arrow Page 4 - Silverlight 2.0 Application Development wi...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Silverlight 2.0 Application Development with LINQ to SQL and a WCF Service
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2008-11-12

    Table of Contents:
  • Silverlight 2.0 Application Development with LINQ to SQL and a WCF Service
  • Creating a Visual Studio 2008 solution to work with “LINQ to SQL”, WCF and Silverlight 2.0
  • WCF development
  • Silverlight development
  • Troubleshooting configurations
  • Troubleshooting configurations: continued

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Silverlight 2.0 Application Development with LINQ to SQL and a WCF Service - Silverlight development


    (Page 4 of 6 )

    Now we need to develop a Silverlight 2 application which consumes the previously mentioned WCF Service. You need to take the following steps.

    • Add a new “Silverlight Application” project to the existing solution and name it “DemoSL.” You should get two projects, “DemoSL” and “DemoSL.Web” (as explained in my previous article).

    • Configure the virtual path of “DemoSL.Web” to point to your local IIS (just as you did in the previous section).

    • Add “Service Reference” to the “WCF Service” project available within your solution.

    • Go to File || Add || New Project (to the existing solution).

    • Configure “ServiceReferences.ClientConfig” in “DemoSL” accordingly (explained in previous article). Rebuild the solution.

    • Modify your code in Page.xaml, so that it looks like the following:


    <UserControl x:Class="DemoSL.Page"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Width="400" Height="300" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">

     <Grid x:Name="LayoutRoot" Background="White">

     <Grid.RowDefinitions>

     <RowDefinition Height="0.15*"/>

     <RowDefinition Height="0.25*"/>

     <RowDefinition Height="0.60*"/>

     </Grid.RowDefinitions>

     <Button HorizontalAlignment="Left" Margin="5,5,0,0" VerticalAlignment="Stretch" Width="76" Content="Show" x:Name="btnShow" Height="30" />

     <TextBlock Margin="5,5,0,0" VerticalAlignment="Stretch" Text="" TextWrapping="Wrap" x:Name="lblMsg" Height="22" Grid.Row="1" />

     <data:DataGrid x:Name="dgEmployees" AutoGenerateColumns="True" Grid.Row="2"></data:DataGrid>

     </Grid>

    </UserControl>


    Once the datagrid control is added to the Silverlight application, you should have an assembly named “System.Windows.Controls.Data” added to your reference list (if not, you should add it manually). You should also observe the namespace “my” added to the “UserControl” tag.

    Go to the code-behind of “Page.xaml” and modify the code to look like the following:


    Partial Public Class Page

    Inherits UserControl


    Public Sub New()

    InitializeComponent()

    End Sub


    Private Sub btnShow_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnShow.Click

    Me.lblMsg.Text = "Fetching..."

    Dim objService As New EmpService.EmpServiceClient

    AddHandler objService.GetEmployeeListCompleted, AddressOf EmployeeListFetched

    objService.GetEmployeeListAsync()

    End Sub


    Private Sub EmployeeListFetched(ByVal sender As Object, ByVal e As EmpService.GetEmployeeListCompletedEventArgs)

    Me.dgEmployees.ItemsSource = e.Result

    Me.lblMsg.Text = "Fetched!"

    End Sub


    End Class


    Once you execute your Silverlight application, you should see the output as follows:


    More Windows Scripting Articles
    More By Jagadish Chaterjee


       · Thanks for a great article! Nice explanation!One issue I had was after I added...
     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek