如何使用样式将数据模板添加到wpf组合框的工具提示中
我正在尝试格式化组合框中的工具提示。以下XAML正确地拾取了工具提示所需的值,但没有拾取数据模板如何使用样式将数据模板添加到wpf组合框的工具提示中,wpf,combobox,tooltip,datatemplate,Wpf,Combobox,Tooltip,Datatemplate,我正在尝试格式化组合框中的工具提示。以下XAML正确地拾取了工具提示所需的值,但没有拾取数据模板 <DataTemplate DataType = "ToolTip"> <TextBlock Width = "200" TextWrapping = "Wrap" Text = "{Binding}" /> </DataTemplate> <Style x:Key = "RadComboBoxStyl
<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>
我确信这不会像我现在做的那样困难:)
谢谢
Jeremy您可以使用
<ComboBox>
<ComboBox.ToolTip>
<!-- custom tip -->
</ComboBox.ToolTip>
</ComboBox>
但除此之外,不妨尝试:
<DataTemplate DataType="{x:Type ToolTip}">
您可以使用
<ComboBox>
<ComboBox.ToolTip>
<!-- custom tip -->
</ComboBox.ToolTip>
</ComboBox>
但除此之外,不妨尝试:
<DataTemplate DataType="{x:Type ToolTip}">
这不起作用。我真的很想在样式中这样做——我在表单上有大约20个组合框,我宁愿在样式中对它们进行全面的更改,也不必触摸每一个组合框。这是行不通的。我真的很想在样式中这样做——我在表单上有大约20个组合框,我宁愿在样式中对它们进行全面更改,也不必触摸每个组合框。