Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
ToolTip for template column
posted

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

Parents
  • 6365
    Offline posted

    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 you have any further questions, please let me know.

    XamGrid_sample.zip
Reply Children