在下面的XAML中,ToolTip正确地绑定到RelativeSource Self。但是,我不能为我的生活工作如何获得在评论块的TextBlock指SelectedItem.DescriptionWPF - 简单相对路径 - FindAncestor
<Controls:RadComboBoxWithCommand x:Name="cmbPacking"
Grid.Row="2"
Grid.Column="5"
ItemsSource="{Binding PackingComboSource}"
DisplayMemberPath="DisplayMember"
SelectedValuePath="SelectedValue"
SelectedValue="{Binding ElementName=dataGrid1, Path=SelectedItem.PackingID}"
ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Description}"
IsSynchronizedWithCurrentItem="True"
Style="{StaticResource comboBox}">
<!-- <Controls:RadComboBoxWithCommand.ToolTip>-->
<!-- <TextBlock Text="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Description}" TextWrapping="Wrap" Width="50"/>-->
<!-- </Controls:RadComboBoxWithCommand.ToolTip>-->
</Controls:RadComboBoxWithCommand>
我将不胜感激任何建议
谢谢 - 杰里米
不幸的是,这并不工作,也不使用FindAncestor有用。但是,经过多一点研究,我发现这篇文章http://blogs.msdn.com/tom_mathews/archive/2006/11/06/binding-a-tooltip-in-xaml.aspx。您需要绑定到PlacementTarge。 – 2010-04-05 21:06:11