Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you show a tooltip for a DataGridComboBoxColumn?
    text
    copied!<p>I want to show a tool tip for the element style (the non-editing mode) of a <strong>DataGridComboBoxColumn</strong>. I have not been able to figure out a good way of doing this. In the example below I can either show a tooltip, or allow edits to the cell by changing the <strong>IsHitTestVisible</strong> property to true or false. I have been unable to both show the tooltip when not editing and allow the initiation of editing mode. When hit test is true the tool tip works. When hit test is false the combo box will drop down.</p> <p>What is the best way to get both editing and a tool tip?</p> <pre><code>&lt;Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"&gt; &lt;Grid&gt; &lt;DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" &gt; &lt;DataGrid.Columns&gt; &lt;DataGridComboBoxColumn Header="Yo"&gt; &lt;DataGridComboBoxColumn.ElementStyle&gt; &lt;Style TargetType="{x:Type ComboBox}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="ComboBox"&gt; &lt;TextBlock Text="{TemplateBinding Text}" IsHitTestVisible="False" ToolTip="Yo"/&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/DataGridComboBoxColumn.ElementStyle&gt; &lt;/DataGridComboBoxColumn&gt; &lt;/DataGrid.Columns&gt; &lt;/DataGrid&gt; &lt;/Grid&gt; &lt;/Window&gt; using System; using System.Collections.Generic; using System.Windows; namespace WpfApplication2 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = new List&lt;string&gt; { "Hello" }; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload