wpf mouse left button or button click events are not fire on text box

Jul 15 2010 1:36 AM

Hai,
this is koti all know about me i face one problem with text box in wpf when i click on the text box with mouse , mouse click event is not fired plz see... teh code as follow in net i find one solution that is
in load event of the page
textbox1.AddHandler(MouseLeftButtonDown, System.Windows.Input.MouseButtonEventHandler(this.mouseLeftDown),true);  but it display the error what is the problem here is xaml
xaml file:-

<
Page x:Class="WpfApplication1.button"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="button"
>
<Grid>
<StackPanel>
<TextBox Name="textbox1" MouseLeftButtonDown="textbox1_MouseLeftButtonDown" MouseDown="textbox1_MouseDown" ></TextBox>

</StackPanel>
</Grid>
</
Page>
c# code:-
private void textbox1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("");
}
private void textbox1_MouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("md");

}

 

Answers (2)