Data Templating, Conversion, and Validation
Consider a simple example of a ListBox bound to the CompanyName column of a table named Customers. The following is the XAML markup for the example:
<Grid Height="383" Width="508"> <ListBox Height="155" HorizontalAlignment="Left" Margin="12,29,0,0" Name="listBox1" VerticalAlignment="Top" Width="202" ItemsSource="{Binding}"> </ListBox> <TextBlock Height="22" HorizontalAlignment="Left" Margin="12,0,0,0" Name="textBlock1" Text="Company Name" VerticalAlignment="Top" Width="146" /> </Grid>
The code-behind class logic is as follows:
using System; . . . using Silverlight_and_Data.NorthwindServiceReference; namespace Silverlight_and_Data { public partial class MainPage : Page { public MainPage() { InitializeComponent(); ...
Get XAML Developer Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.