가 나는 목록 < 인 ProductInfo> ...텍스트를 유지하지 않는 AutoCompleteBox
public class ProductInfo
{
public override string ToString()
{
return Name + " - " + Description;
}
public string Name { get; set; }
public string Description { get; set; }
}
이 성공적으로 정의 된 다음 DataTemplate을 가진 사용자 AutoCompleteBox에 이름과 설명을 반환 반환하고있어 실버 라이트 테스트 프로젝트가 있습니다
<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>
항목이 선택되면 의
는 그러나 AutoCompleteBox는 (WCF 서비스에 의해 반환 된) 오브젝트 유형의 이름 ...
IdeasAndTesting_SL_01.ServiceReference1.ProductInfo
당신은 내가의 toString() 메서드를 오버라이드 것을 알 수 있습니다으로 채 웁니다 인 ProductInfo 객체는, 그래서 왜 않습니다이 또는 그것을 해결하는 방법을 모르겠어요. 아이디어?
+1 마크 티의 대답은 내가 향하고있는 곳이다. –