Hi,
I try to display a custom Tooltip on cell... i have to fully customize the UI of my tooltip to display a custom details
I' try this but doesn't work:
<local:TooltipVisibilityConverter x:Key="visibilityConverter"/> <ToolTip x:Key="ToolTipControl" Visibility="{Binding Converter={StaticResource visibilityConverter}}" DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Border HorizontalAlignment="Stretch" BorderThickness="0,0,0,1" BorderBrush="Black" Margin="5" Grid.Row="0"> <TextBlock FontSize="14" Text="{Binding Path=Record.DataItem}"/> </Border> <TextBlock Grid.Row="1" Margin="10,0,5,0" Text="{Binding Path=Record.DataItem.Index}"/> </Grid> </ToolTip>
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="ToolTip" Value="{StaticResource ToolTipControl}" /> </Style>
Can you tell me how i can do that... Need a working Example Please.
Thx
Hello Michel,
Thank you for your post.
Before continuing with this thread, I would just like to confirm that you are actually using the XamPivotGrid in this case. I ask, as the ToolTip and the Style that you have provided look like they from something that was targeting the XamDataGrid, as the DataRecordPresenter element and the bindings to Record.DataItem are not going to exist anywhere in the XamPivotGrid.
Are you using the XamPivotGrid or the XamDataGrid in this case?
I'm using the XamPivotGrid .
I need to know the XAML way for more flex. behaviors
thx.
I have reproduced the behavior where the XamPivotGrid is essentially “losing” the tooltip after expansion and sometimes after horizontal scrolling. After looking at the XamPivotGrid with a UI inspection tool, I can see that the PivotCellControl instances are retaining the Style that is applied, but for some reason the tooltip is lost.
I have devised a workaround to this in that you can set the ContentTemplate of the PivotCellControl and set the Tooltip on the elements that you define there. Note, that you will need a converter to get the PlacementTarget of your tooltip back up to the PivotCellControl, but doing this does not lose the tooltip.
I am attaching a sample project to demonstrate this workaround.
This “lost tooltip” behavior is unexpected, and as such, I have asked our engineering staff to examine it further. To ensure it receives attention, I have logged this behavior in our internal tracking systems with a development ID of 257994. I have also created you a private support case that I will link to this behavior so you can be notified when a fix or other resolution becomes available. It has an ID of CAS-198195-D2G8Y9 and you can access it here.
Please let me know if you have any other questions or concerns on this matter.
XamPivotGridTooltipDemoWorkaround.zip
3073.XamPivotGridTooltipDemo.zipThx
When i expand some measurement column or scroll Horizontaly the tooltip does not want to show anymore.
I'm missing something ?
To target a specific Column in XAML, I would recommend using a DataTrigger in your style for PivotCellControl. In this DataTrigger you can set up a binding to the PivotCellControl.Cell.Column or DataColumn and determine whether or not the tooltip should be applied. For example, using the following style, the tooltip would only be applied to a PivotCellControl whose Column’s HeaderText = “All Periods.”
<Style TargetType="{x:Type ig:PivotCellControl}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Cell.Column.HeaderText}" Value="All Periods"> <Setter Property="ToolTip" Value="{StaticResource myTooltip}"/> </DataTrigger> </Style.Triggers> </Style>
Thx for the fast reply.
How i can target a specific Column XAML way?
I want to dispaly more details in tooltip for specific Columns. the details is binded to another property in the datacontext.
Thank you very much
Thank you for your update.
The XamPivotGrid is a much different architecture than the XamDataGrid. As such, styling the DataRecordPresenter element in this case will not help you at all, as the XamPivotGrid does not use this element in any way. Instead, if you are looking to place a Tooltip on your XamPivotGrid cells, I would recommend styling the PivotCellControl element instead.
As you are binding the DataContext of your ToolTip to its PlacementTarget, this will give you access to the Cell property of the PivotCellControl, which returns a PivotCell element. This will allow you to access the owning Column, and the displayed Data on the cell.
I am attaching a sample project to demonstrate the above in which a similar tooltip to the one you have provided is used. I hope this helps you.
XamPivotGridTooltipDemo.zip