我正在尝试在ComboBox中格式化工具提示。以下XAML正确地获取了ToolTip所需的值,而不是DataTemplate。
<DataTemplate DataType = "ToolTip">
<TextBlock Width = "200" TextWrapping = "Wrap" Text = "{Binding}" />
</DataTemplate>
<Style x:Key = "RadComboBoxStyle1" TargetType = "{x:Type telerik:RadComboBox}">
<Setter Property = "Width" Value = "140" />
<Setter Property = "DisplayMemberPath" Value = "DisplayMember" />
<Setter Property = "SelectedValuePath" Value = "SelectedValue" />
<Setter Property = "ToolTip" Value = "{Binding RelativeSource={RelativeSource Mode=Self}, Path=SelectedItem.Description}" />
</Style>
我确信它不会像我做的那样困难:)
由于 杰里米
答案 0 :(得分:1)
您可以使用
定义工具提示<ComboBox>
<ComboBox.ToolTip>
<!-- custom tip -->
</ComboBox.ToolTip>
</ComboBox>
但也许可以尝试:
<DataTemplate DataType="{x:Type ToolTip}">