---
title: "Popup appearing on mouse over"  
description: "Popup appearing on mouse over"  
author: "Anonymous User"  
published: 2013-08-09  
updated: 2013-08-10  
canonical: https://www.mindstick.com/forum/1365/popup-appearing-on-mouse-over  
category: "wpf"  
tags: ["wpf"]  
reading_time: 2 minutes  

---

# Popup appearing on mouse over

Hi [Mindstick](https://yourviews.mindstick.com/view/84668/how-mindstick-is-used-for-marketing-purposes)!I want a popup to appear every time I hover a [togglebutton](https://www.mindstick.com/forum/12937/how-to-style-togglebutton-so-that-the-background-color-is-white). It then needs to stay open until I click [somewhere else](https://answers.mindstick.com/qa/94737/i-want-to-learn-android-studio-is-it-better-to-learn-from-its-official-website-or-should-i-learn-from-somewhere-else) in the application. The code below [works fine](https://answers.mindstick.com/qa/115732/my-software-works-fine-on-windows-10-but-crashes-on-windows-11-why) on start up but as soon as I check or uncheck the togglebutton the popup refuses to appear. Any ideas on what I'm [doing wrong](https://answers.mindstick.com/qa/36736/what-are-indians-doing-wrong-on-whatsapp)?\
The WPF code\
<ToggleButton Name="btnLogFile" Style="{StaticResource StandardToggle}" Grid.Row="1" Grid.Column="3" Margin="0,3,3,0" MouseEnter="btnLogFile_MouseEnter"> <Path Margin="7" SnapsToDevicePixels="True" Stretch="Uniform" Stroke="{StaticResource TextLight}" StrokeThickness="2"> <Path.Data> <GeometryGroup FillRule="Nonzero"> <PathGeometry Figures="M 0 0 L 20 0 L 20 10 L 30 10 L 30 40 L 0 40 Z" /> <PathGeometry Figures="M 20 0 L 22 0 L 30 8 L 30 10" /> </GeometryGroup> </Path.Data> </Path> </ToggleButton> <Popup Name="popLogFile" PlacementTarget="{Binding ElementName=btnLogFile}" [Placement](https://answers.mindstick.com/qa/111373/what-are-the-benefits-of-taking-advanced-placement-ap-courses)="Custom" HorizontalOffset="0" VerticalOffset="0" MouseLeftButtonDown="popLogFile_MouseLeftButtonDown"> <Border [Background](https://www.mindstick.com/articles/65/how-to-change-background-color-of-tab-control-in-c-sharp)="{StaticResource BackgroundDark}" BorderBrush="{StaticResource TextBoxBorder}" BorderThickness="1" Width="300" Height="Auto"> <Grid Margin="3"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="3" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="3" /> <ColumnDefinition Width="22" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="22" /> </Grid.RowDefinitions>\
<TextBlock Margin="0,1" Grid.Row="0" Grid.Column="0" Foreground="{StaticResource TextLight}" HorizontalAlignment="Right">[Directory](https://www.mindstick.com/forum/226/how-to-get-application-directory-using-c-sharp-csharp)</TextBlock> <TextBox Name="logfilePath" Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" Style="{StaticResource StandardTextBox}" Foreground="{StaticResource TextLight}"> C:\logfile.txt </TextBox><!-- Button made invisible for the time being --> <Button Name="btnBrowseLogfile" Style="{StaticResource StandardButton}" Grid.Row="0" Grid.Column="4" [Visibility](https://www.mindstick.com/blog/301300/how-to-improve-your-visibility-in-zero-click-search-results)="Collapsed">...</Button>\
</Grid> </Border> </Popup>And the togglebutton's mouse event:\
[private](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) void btnLogFile_MouseEnter(object sender, MouseEventArgs e) { this.popLogFile.IsOpen = true; this.popLogFile.StaysOpen = false; }tanks in advance\

## Replies

### Reply by Pravesh Singh

Do not use code to manipulate UIElements. Bind the IsOpen Property of the Popup to the IsMouseOver property of the togglebutton. Or else if you need multiple or more complex conditions, set a Style to the Popup and in the style you can include Triggers or DataTriggers. I suggest you take a look at this WPF Tutorial

Edit:

Should be something like:

<DataTrigger Binding="{Binding IsChecked, ElementName=YourToggleButton}" Value="True">

<Setter TargetName="ThePopup" Property="IsOpen" Value="True"/>

</DataTrigger>


---

Original Source: https://www.mindstick.com/forum/1365/popup-appearing-on-mouse-over

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
