Click here to Skip to main content
15,918,976 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to Catch Event with Grid in WPF.
Updated 13-Jun-12 9:59am
db7uk 11-Jun-12 14:49pm    
oh, If you have any xaml to post this should be better to help. If you need to "Improve Question" with xaml and you'll probably get a better answer.

You are going to need DynamicResources applied to the styling. A good example of grid styling is :[^]
Share this answer
You just need to use PreviewEvent Which is Something like that,

<grid name="grid1" verticalalignment="Top" background="AliceBlue" previewmouseleftbuttondown="TestPreview"></grid>

And on the code behind,

private void TestPreview(object sender, MouseEventArgs e)
  grid1.Background = Brushes.Blue;

Now you can do it in your own way. But i would suggest you to look on to the RoutedEvent thoroughly. If you want you might have a look on that [^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900