Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Tooltip is clipped from other Usercontrols #229

Closed
camou23 opened this issue Jun 27, 2016 · 5 comments
Closed

Tooltip is clipped from other Usercontrols #229

camou23 opened this issue Jun 27, 2016 · 5 comments
Labels

Comments

@camou23
Copy link
Contributor

camou23 commented Jun 27, 2016

image

Is it maybe possible to give the Tooltip an Zindex of 100 maybe?
So it wouldnt be clipped from other Usercontrols.

I cant find the right place in the code.

@camou23
Copy link
Contributor Author

camou23 commented Jun 27, 2016

image

It gets also clipped by the Window Boundries

@camou23
Copy link
Contributor Author

camou23 commented Jun 27, 2016

#230 should fix this i think

@camou23
Copy link
Contributor Author

camou23 commented Jun 30, 2016

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Jul 14, 2016

This answer is out of date, please if you are using 0.9.2 or greater see the next comment

You PR was a nice try but it was not going to be enough, pelase see this alternative.

To solve this what we actually need to do is add tooltip at the chart UI level, so we can always set a higher zindex than all the charts.

My idea was to wrap all the controls you need to force the tooltip to draw over, all the charts in this container must share this tooltip, also notice the tooltip will never go out the container, as you mentioned, it could overflow the window, with this method we also fix that.

For a full example see https://github.com/beto-rodriguez/Live-Charts/tree/master/Examples/Wpf/CartesianChart/SharedTooltip

Here a code snippet

    <Canvas Name="CanvasContainer">

        <!-- 
        the tooltip requires a canvas to move properly, 
        so lets wrap our view where you need a shared tooltip 
        with a Canvas container
        -->

        <lvc:DefaultTooltip Name="CurrentTooltip" Visibility="Hidden" 
                            Panel.ZIndex="100"
                            Canvas.Left="0" Canvas.Top="0"
                            IsWrapped="True">
            <!--
            it needs to: 
            1. Have an initial position
            2. Be hidden on startup
            3. to be wrapped in a Canvas, and say it with IsWrapped = true
            -->
        </lvc:DefaultTooltip>

        <Grid Height="{Binding ActualHeight, ElementName=CanvasContainer}" 
              Width="{Binding ActualWidth, ElementName=CanvasContainer}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <lvc:CartesianChart Grid.Column="0" Background="White"
                            DataTooltip="{Binding ElementName=CurrentTooltip}">
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}"></lvc:LineSeries>
                </lvc:CartesianChart.Series>
            </lvc:CartesianChart>
            <lvc:CartesianChart Grid.Column="1" Background="White"
                            DataTooltip="{Binding ElementName=CurrentTooltip}">
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}"></lvc:LineSeries>
                </lvc:CartesianChart.Series>
            </lvc:CartesianChart>
            <lvc:CartesianChart Grid.Column="2" Background="White"
                            DataTooltip="{Binding ElementName=CurrentTooltip}">
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}" ></lvc:LineSeries>
                </lvc:CartesianChart.Series>
            </lvc:CartesianChart>
        </Grid>
    </Canvas>

And the result

tooltipwrapper

@beto-rodriguez
Copy link
Collaborator

beto-rodriguez commented Feb 5, 2017

From 0.9.2 and above this scenario is automatically handled with 8e31b12, there is no need to wrap the tooltip in a container as it was in the previous versions, if you already did this in your code, your wrapping will be ignored but you code should compile correctly, there is no need to change your code, but I recommend you to do so just because it is now cleaner and this step is not necessary

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants