Created
August 11, 2017 18:13
-
-
Save julesx/8a673feb038ad61e44411c7df3dff241 to your computer and use it in GitHub Desktop.
MouseEnterTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="WpfApplication16.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:WpfApplication16" | |
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="350" Width="525"> | |
<StackPanel MouseEnter="UIElement_OnMouseEnter"> | |
<ListBox> | |
</ListBox> | |
<i:Interaction.Triggers> | |
<i:EventTrigger EventName="MouseEnter"> | |
<i:InvokeCommandAction Command="{Binding CmdMouseEnter}" /> | |
</i:EventTrigger> | |
</i:Interaction.Triggers> | |
</StackPanel> | |
</Window> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; | |
using System.Windows.Navigation; | |
using System.Windows.Shapes; | |
using Core.Utils.Classes; | |
namespace WpfApplication16 | |
{ | |
public partial class MainWindow : Window | |
{ | |
private ICommand _mouseEnter; | |
public ICommand CmdMouseEnter | |
{ | |
get | |
{ | |
if (_mouseEnter == null) | |
_mouseEnter = new RelayCommand(TestMouseEnter); | |
return _mouseEnter; | |
} | |
} | |
private void TestMouseEnter(object o) | |
{ | |
Console.WriteLine("data context mouse enter"); | |
} | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
DataContext = this; | |
} | |
private void UIElement_OnMouseEnter(object sender, MouseEventArgs e) | |
{ | |
Console.WriteLine("code behind mouse enter"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment