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