Have you tried post# 7? I did not use any DataForm but just a StackPanel with TextBlocks for simplicity. The values change when ComboBox Selection changes. It should be the same idea when you use your DataForm. It is critical that you know the fields so you can bind to them in XAML. Note also that you cannot expect a field that is not included in the query to show unless you had specified them in the OutFields or "*".
Sorry Jenn, I had missed the subtly of your suggestion. (I had placed the stackpanel inside the dataform.) And Yes! it does work. Which makes me wonder why it will NOT work in the dataform. Look at this: <toolkit:DataForm x:Name="IdentifyDataForm3" ItemsSource="{Binding}" HorizontalAlignment="Left"
MinWidth="400" MaxWidth="500" Margin="4" Grid.Column="1">
<toolkit:DataForm.EditTemplate>
<DataTemplate>
<StackPanel>
<sdk:Label Content="Street Name:"/>
<toolkit:DataField>
<TextBox Text="{Binding ST_NAME, Mode=OneWay}"/>
</toolkit:DataField>
<sdk:Label Content="Project:"/>
<toolkit:DataField>
<TextBox Text="{Binding PROJECT, Mode=OneWay}"/>
</toolkit:DataField>
</StackPanel>
</DataTemplate>
</toolkit:DataForm.EditTemplate>
</toolkit:DataForm>
<toolkit:DataForm x:Name="dataForm"
Width="350"
ItemsSource="{Binding}"
HorizontalAlignment="Left"
MaxWidth="500"
Margin="4"
Grid.Column="1"
VerticalAlignment="Center"/>
<StackPanel x:Name="MyForm" VerticalAlignment="Top" HorizontalAlignment="Center" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Name: "/>
<TextBlock Text="{Binding [ST_NAME]}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Project: "/>
<TextBlock Text="{Binding [PROJECT]}"/>
</StackPanel>
</StackPanel>
with codebehind: void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int index = IdentifyComboBox.SelectedIndex;
if (index > -1)
try
{
IdentifyDetailsDataGrid.ItemsSource = _dataItems[index].Data;
IdentifyDataForm3.DataContext = _dataItems[index].Data ; ////////////////////////////////
dataForm.DataContext = _dataItems[index].Data ;
MyForm.DataContext = _dataItems[index].Data;
}
catch
{
}
}
The plain stackpanel works, but neither of the dataforms will show the requested data. Go figure?