Link to home
Start Free TrialLog in
Avatar of dpdmembers
dpdmembersFlag for Barbados

asked on

Bind Database to Silverlight 4 Chart

How do I Bind a Database to my Silverlight 4 Chart with VB
Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

Silverlight doesn't support any database providers. You need to get the data using a web service or wcf service. This data willbe put in a data model and will be binded to silverlight chart control.
Avatar of dpdmembers

ASKER

I have created the service but I need help with the binding to the chart.  I can bind it to a datagrid but not a chart.
can we your xaml code and binding code?
XAML Code

<UserControl x:Class="SilverlightWithWCFService.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="650" d:DesignWidth="525" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">

    <Grid x:Name="LayoutRoot" Background="White" Height="650" Width="847">
           <toolkit:Chart  HorizontalAlignment="Left" Margin="27,432,0,0" Name="Chart1" Title="LEI Index" VerticalAlignment="Top" Height="206" Width="452">
            <toolkit:Chart.Series>
                <toolkit:ColumnSeries x:Name="ColumnSeries1" Title="Index"  
                                  IndependentValueBinding="{Binding Observation}"
                                  DependentValueBinding="{Binding LEI_Index}"
                                   ItemsSource="{Binding}"   />
                         
            </toolkit:Chart.Series>
        </toolkit:Chart>
    </Grid>
</UserControl>

Behind Code

 Private Sub client_LEIListCompleted(ByVal sender As Object, ByVal e As LEIListCompletedEventArgs)
          ColumnSeries1.ItemsSource = e.Result
    End Sub

ASKER CERTIFIED SOLUTION
Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Examples would be nice