I have a Silverlight test project where I'm returning a List< ProductInfo > ...
public class ProductInfo
{
public override string ToString()
{
return Name + " - " + Description;
}
public string Name { get; set; }
public string Description { get; set; }
}
It is successfully returning the name and description into a customized AutoCompleteBox with the following DataTemplate defined:
<DataTemplate x:Key="SearchBoxDataTemplate">
<StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="0, 0, 8, 0">
<TextBlock HorizontalAlignment="Right" Foreground="Blue"
FontSize="18" Text="{Binding Name}" Padding="2" />
<TextBlock HorizontalAlignment="Right" Foreground="Black"
FontSize="8" Text="{Binding Description}" Padding="2" />
</StackPanel>
</DataTemplate>
However, once an item is selected, the AutoCompleteBox populates with the name of the object type (returned by a WCF service)...
IdeasAndTesting_SL_01.ServiceReference1.ProductInfo
You'll notice that I overrode the ToString() method of the ProductInfo object, so I'm not sure why this does this or how to resolve it. Ideas?