Could not able to fire events to StackPanel which is inside the ScrollViewer.
we tried with Panel.ZIndex but no luck.
Greatly appreciated for help.
Window1.xaml file
Minimum="{Binding ElementName=root, Path=Minimum}"
Maximum="{Binding ElementName=root, Path=Maximum}"
Value="{Binding ElementName=root, Path=UpperValue, Mode=TwoWay}"
Margin="0,15,0,0" />
Window1.xaml.cs file
private void xxScrollBar_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.Source.GetType() == typeof(StackPanel))
{
}
}
private void StackPanel_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("Clicked on StackPanel");
}
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("Clicked on StackPanel");
}
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Nagi APosted Jan 24, 2017, 5:17 AM
Shweta LodhaPosted Jan 24, 2017, 3:46 AM
Hello Negi,
I tried the code which you pasted here and I'm able to get messagebox mentioned in event named:
StackPanel_PreviewMouseDown
Please elaborate more, which event are you talking about? If you are talking about MouseDown event then here is your answer: