bart
bart

Reputation: 324

Control doesnt respond to mouse actions because it's on bottom of view hierarchy

I have a ContentControl with following DataTemplate

xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"
....
<DataTemplate DataType="{x:Type y:DataGraph}">
                <Grid>
                    <!--Because PlotView is under Label it doesnt respond to mouse actions (click, zoom, etc)-->
                    <oxy:PlotView  Model="{Binding PlotViewModel}"/>
                    <!--Want Label to be displayed on top-->
                    <Label Content="some text"/>
                </Grid>
            </DataTemplate>

I want some text to be displayed on top of oxy:PlotView, but if I do so, oxy:PlotView stops to respond to mouse actions (zoom, click etc).

How can I show label hovering another control, but make bottom control remain responding to mouse actions?

Upvotes: 0

Views: 46

Answers (1)

LordWilmore
LordWilmore

Reputation: 2912

Try setting the IsHitTestVisible property of the Label to False. Mouse clicks will then pass straight through it.

If you're ever wondering where the clicks are going then fire up Snoop, attach to your window, open the Events tab, click on the thing in your program, then see what happened to your event back in Snoop.

Upvotes: 1

Related Questions