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.
Posted
Updated 13-Jun-12 9:59am
v3
Comments
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 : http://msdn.microsoft.com/en-us/library/ff506248.aspx[^]
 
Share this answer
 
You just need to use PreviewEvent Which is Something like that,

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


And on the code behind,

C#
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