Sunday, May 16, 2010

Silverlight - Connecting to remote database - WCF

This tutorial will show how connect to a server database from a Silverlight application. I will be using Visual Studio 2010 and Silverlight 4. So first, we will create a Silverlight 4 application..

Next, we are just going to put a DataGrid on our MainPage.xaml. I have given the XAML so it can be copied and pasted.

<UserControl x:Class="SilverlightWCFTutorial.MainPage"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   mc:Ignorable="d"
   d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

   <Grid x:Name="LayoutRoot" Background="White">
       <sdk:DataGrid
           Name="dataGridPerson"
           AutoGenerateColumns="True"
           Height="206"
           HorizontalAlignment="Left"
           Margin="12,44,0,0"  
           VerticalAlignment="Top"
           Width="376"
           ItemsSource="{Binding}">
       </sdk:DataGrid>
   </Grid>
</UserControl>

Read more: </dream-in-code>

Posted via email from jasper22's posterous