Image over control displayed via multidatatrigger

306 views Asked by At

I'm trying to display a small image over a larger border control. The image must be displayed when the mouse is over this border and the second condition is the dpmenu is collapsed. But the trigger ismouseover is not raised when the mouse is over the image (which is over the border). The image is flickered as a result :(

I'd like the image displayed when mouse is over border and over image too.

<Grid>
<Grid.Resources>
    <Style TargetType="Image" x:Key="ImageConditionnalvisibility">
        <Setter Property="Visibility" Value="Collapsed" />
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                   <Condition Binding="{Binding ElementName=BrowserBorder, Path=IsMouseOver, Mode=OneWay}" Value="True" />
                    <Condition Binding="{Binding ElementName=dpMenuTop,Path=Visibility}" Value="Collapsed" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" />
            </MultiDataTrigger>

        </Style.Triggers>
    </Style>
</Grid.Resources>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
...
<Border Grid.Row="1" Name="BrowserBorder" Width="500" Height="500" />
<Image Grid.Row="1" Width=16" Height="16" Style="{StaticResource   ImageConditionnalvisibility}" ... />
1

There are 1 answers

0
brunnerh On BEST ANSWER

You could create another MultiDataTrigger where the Border condition is replaced with the Image.