Let us begin with a simple instance where we will make use of the main concepts related to data binding, and how data is bound to controls in a declarative way. Similar to the previous chapters, we will create a brand new Silverlight project called, in this case, MyFirstDataBinding
. We will create a translator of the message "Hello World" into different languages. A ComboBox control will show the available languages, and a textbox will show the result. We will establish binding in a declarative way.
We start by adding content to the MainPage.xaml
file so that it has the aspect in the previous screenshot with the following code snippet:
<Grid x:Name="LayoutRoot" VerticalAlignment="top" HorizontalAlignment="Left" Margin="20" Background="#FFCFCFD0" Width="440" Height="100"> <Grid.RowDefinitions> <RowDefinition Height="30" /> <RowDefinition Height="30" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <Grid...