Hi,
I am using the ToolTipContentTemplate to show the tooltip on one of the XAMGRID template column.The XAML snippet for the same is shown below:
<Ig:TemplateColumn.ToolTipContentTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding SomeField}" />
</StackPanel>
</DataTemplate>
</Ig:TemplateColumn.ToolTipContentTemplate>
This template column has a ItemTemplate (TextBlock) and a EditorTemplate (Control derived from TextBox).
With the above code the tooltip appears as expected but one of my requirement is to conditionally remove the tooltip for the cells at runtime. The tooltip should not be visible even if it is in edit mode.
I would appreciate, if you could please provide some guidance for the implementation of the above requirement.
Thanks,
Samson Tuscano
Hello Samson,
Thank you for the code-snippet and the description you have provided.
In order to disable the cells' ToolTips of a Column based on a condition, the easiest way would be by setting the AllowToolTips property of the respective Column to Never when the certain condition is met/not met.
This way by explicitly performing the condition check, you will be able to either enable or disable the tooltips.
I have attached a sample application, where the CellExitedEditMode event of the XamGrid has been handled and whenever a cell from the Weight column becomes greater than a certain value, the tooltips of the column will get disabled.
private void xamGrid_CellExitedEditMode(object sender, CellExitedEditingEventArgs e){ var weightColumn = (sender as XamGrid).Columns["Weight"] as Column; if (e.Cell.Column == weightColumn && IsAnyWeightCellValueGreaterThan(20.0)) { weightColumn.AllowToolTips = AllowToolTips.Never; } else { weightColumn.AllowToolTips = AllowToolTips.Always; }}
if (e.Cell.Column == weightColumn && IsAnyWeightCellValueGreaterThan(20.0)) { weightColumn.AllowToolTips = AllowToolTips.Never; } else { weightColumn.AllowToolTips = AllowToolTips.Always; }}
If you have any further questions, please let me know.
Hi Tacho,
Thank you for your help.
I've checked your sample application, and i have noticed that it disables the Tooltip for the entire column(all cells in that column).
But, my requirement is to disable the Tooltip for a specific cell in a column.
Please suggest.
Thanks and regards,