To get something to appear I had to add:
DataForm.CurrentItem = client;
to the code.
This just displayed three text boxes with no labels and the entries "Test1", "Test2" and "Test3". Is this what you were expecting?
The Silverlight Toolkit samples page has an example of a template driven data form and it's XAML looks like this:
<dataform:DataForm x:Name="dataForm" ItemsSource="{Binding}" HorizontalAlignment="Left" MinWidth="400" MaxWidth="500" Margin="4" Grid.Column="1">
<dataform:DataForm.EditTemplate>
<DataTemplate>
<StackPanel>
<dataform:DataField>
<TextBox Text="{Binding FirstName, Mode=TwoWay}" />
</dataform:DataField>
<dataform:DataField>
<TextBox Text="{Binding Email, Mode=TwoWay}" />
</dataform:DataField>
<dataform:DataField>
<TextBox Text="{Binding Phone, Mode=TwoWay}" />
</dataform:DataField>
<dataform:DataField Label="Calendar">
<controls:Calendar></controls:Calendar>
</dataform:DataField>
</StackPanel>
</DataTemplate>
</dataform:DataForm.EditTemplate>
</dataform:DataForm>
And there's the line:
DataContext = Contact.People;
in the code behind. (The class People
is defined elsewhere as far as I can work out)
ChrisF
2010-01-14 20:15:20