Thursday, February 3, 2011

Property VS Field –XAML Binding- Silverlight

After a brain storming and internet searching for hours together, I came to know that Silverlight do not bind the data from field, but it binds only property.  Following is the declaration methodology

FIeld Dim fullname as string
Property

Property FullName() As String
            Get
                Return namee
            End Get
            Set(ByVal value As String)
                namee = value
            End Set
End Property

Here ‘namee’ is a field declared in the class or etc.

Following the XAML binding to be used:

<sdk:Label Height="28" Content="{Binding FullName}"/>

Hence during the code we can just use Itemsourcebinding for multivalue binding or if the value is only since like in this case then we use dataContext binding, but itemsourcebinding would do the trick too.

No comments:

Post a Comment