1
Public Class Author
{
Public String Name{get;set;}
Public String Description{get;set;}
Public int NumberOfBooks{get;set;}
}
一个Author类和数据绑定List<Author>
通过DataTemplate中以列表框像下面
<ListBox ItemsSource="{Binding Authors}" BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel ToolTipService.ToolTip="{Binding Description}" ToolTipService.Placement="Right">
<TextBlock Text="{Binding Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
如何生成使用XAML中提示描述声明绑定像下面一样
AuthorName (NumberOfBooks)
Description