Silverlight MouseLeftButtonDown event not firing
- by Matt
For the life of me, I can not get this to work. I can get MouseEnter, MouseLeave, and Click events to fire, but not MouseLeftButtonDown or MouseLeftButtonUp.
Here's my XAML
<UserControl x:Class="Dive.Map.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Canvas x:Name="LayoutRoot" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
<Button x:Name="btnTest" Content="asdf" Background="Transparent" MouseLeftButtonDown="btnTest_MouseLeftButtonDown"></Button>
</Canvas>
</UserControl>
And here's my code
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void btnTest_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
btnTest.Content = DateTime.Now.ToString();
}
private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
e.Handled = false;
}
}
What am I doing wrong?