Skip to main content Skip to footer

GrapeCity Spread Silverlight CTP, Part 10 - Data Binding

Spread CTP - Script 10: Data Binding

If you are interested in downloading the Spread CTP, please email labs@grapecity.com .

This is the 10th in a series of Spread CTP Blogs and is a continuation of:

Part 1 : Create an app from scratchPart 2 : AutoFitPart 3 : Borders and Grid LinesPart 4 : Cell FormatPart 5 : Cell OverflowPart 6 : Cell SpanPart 7 : Clipboard OperationPart 8 : Conditional FormattingPart 9 : CSV Import and Export

GcSpreadSheet supports binding to any object that implements the IEnumerable interface. This includes the Ilist, ObservableCollection, and WCF datasource. The control also supports binding to an RIA datasource.

GcSpreadSheet supports one way data binding. Changes to the source automatically update the target but, changes to the target are not propagated back to the source.

Specific columns can be bound with the DataField Property.

Using Code

CS

public class lname
{
public string last { get; set; }
public int val { get; set; }
public lname(string last, int val)
{
this.last = last;
this.val = val;
}
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{

lname[] arr = new lname[] { new lname("Smith", 100), new lname("Fender", 3), new lname("Gill", 5) };
gcSpreadSheet1.Sheets[0].DataSource = arr;
gcSpreadSheet1.Invalidate();

VB.NET

Public Class lname
Public Property last() As String

Get
Return m_last
End Get

Set
m_last = Value
End Set

End Property

Private m_last As String

Public Property val() As Integer

Get
Return m_val
End Get

Set
m_val = Value
End Set

End Property

Private m_val As Integer

Public Sub New(last As String, val As Integer)
Me.last = last
Me.val = val
End Sub

End Class

Dim arr As lname() = New lname() {New lname("Smith", 100), New lname("Fender", 3), New lname("Gill", 5)}
gcSpreadSheet1.Sheets(0).DataSource = arr
gcSpreadSheet1.Invalidate()

clip_image001

Part 11 : Drag and Move

Technorati Tags: Spread,Excel,Silverlight,CTP,labs@grapecity.com,visual studio,AutoFit,borders and Grid lines,cell format,cell overflow,cell span,clipboard,clipboard operation,conditional formatting,CSV,CSV Import and Export,data binding

tweetmeme_url = 'http://www.clubfarpoint.com/Forums/blogs/russells\_blog/archive/2012/04/26/grapecity-spread-silverlight-ctp-part-10-data-binding.aspx'; tweetmeme_source = '@russcamtv'; tweetmeme_hashtags = '#appdev';

MESCIUS inc.

comments powered by Disqus