How to create Silverlight Business Application using Silverlight 3 Ria Services?

Creating Silverlight Business Application using Silverlight 3 Ria Services

Tools that I have used in this tutorial project:

SQL Server 2005 Standard Edition

Visual Studio 2008 Professional/Team System Edition with its SP1

Silverlight 3

Silverlight 3 SDK

Microsoft Expression Blend 3

Microsoft Expression Blend 3 SDK

Microsoft Silverlight 3 Tools for Visual Studio 2008 SP1 – ENU

WCF RIA Services Beta

WCF RIA Services Toolkit (April 2011)

WCF RIA Services v1.0 SP1

This is my main page,
S3RSMainPage

This is my city listing page,
S3RSCityListingPage

This is my city listing xaml,

<navigation:Page xmlns:riaControls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria”  xmlns:data1=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”  x:Class=”MySilverlight3BusinessApplication.Views.CityListing”

           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;

           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;

           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008&#8243;

           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006&#8243;

           mc:Ignorable=”d”

           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”

           xmlns:data= “clrnamespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”

           xmlns:rc=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria”

           xmlns:ds=”clr-namespace:MySilverlight3BusinessApplication.Web.Services”

           d:DesignWidth=”640″ d:DesignHeight=”480″

           Title=”City”>

    <Grid x:Name=”LayoutRoot”>

        <Grid.Background>

            <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>

                <GradientStop Color=”#FF072A39″ Offset=”1″/>

                <GradientStop Color=”#FF0878AB”/>

            </LinearGradientBrush>

        </Grid.Background>

        <Grid.RowDefinitions>

            <RowDefinition Height=”0.112*”/>

            <RowDefinition Height=”0.888*”/>

        </Grid.RowDefinitions>

        <riaControls:DomainDataSource x:Name=”CityDataSource” QueryName=”GetTblCityQuery” AutoLoad=”True”>

            <riaControls:DomainDataSource.DomainContext>

                <ds:TestDbDomainContext></ds:TestDbDomainContext>

            </riaControls:DomainDataSource.DomainContext>

        </riaControls:DomainDataSource>

        <TextBlock Style=”{StaticResource HeaderTextStyle}” HorizontalAlignment=”Left” Margin=”8,8,0,19″ Width=”212″ Text=”City List” TextWrapping=”Wrap”/>

        <data1:DataGrid x:Name=”CityGrid” Grid.Row=”1″ Background=”White” ItemsSource=”{Binding ElementName=CityDataSource, Path=Data}”></data1:DataGrid>

        <!–<data1:DataGrid x:Name=”CityGrid” Grid.Row=”1″ Loaded=”CityGrid_Loaded”></data1:DataGrid>–>

    </Grid>

</navigation:Page>

Here is my code in C# of course,

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Navigation;

using System.Windows.Controls.Data;

using MySilverlight3BusinessApplication.Web.Services;

namespace MySilverlight3BusinessApplication.Views

{

    public partial class CityListing : Page

    {

        public CityListing()

        {

            InitializeComponent();

        }

        // Executes when the user navigates to this page.

        protected override void OnNavigatedTo(NavigationEventArgs e)

        {

        }

        //private void CityGrid_Loaded(object sender, RoutedEventArgs e)

        //{

        //    TestDbDomainContext context = new TestDbDomainContext();

        //    CityGrid.ItemsSource = context.tblCities;

        //    context.Load(context.GetTblCityQuery());

        //}

    }

}

You notice that there are commented out portion on both xaml and my code. I base and follow the steps in this tutorial. Here is my reference link below,

http://dotnetslackers.com/articles/silverlight/RIA-Services-With-Silverlight-3-Part1.aspx

http://dotnetslackers.com/articles/silverlight/RIA-Services-With-Silverlight-3-Part2.aspx

Advertisements
This entry was posted in ASP.NET 3.5 And Silverlight 3, Silverlight 3, WCF RIA Services. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s