Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a page in a WPF window. And in this page i programmically (in another class for methods) create a dynamic grid into which i add rows in realtime, and prior on startup from config file.

Now i also want to delete rows, but for that i need something to happen when i click the "delete" bitmap image which is in every row on the first column. But i have no idea how to target it, or how to create a mouseclick event which i can tie to my ,not in XAML created, grid.

Here is an image of my page and the grid:
https://ibb.co/npJgoo

What I have tried:

I searched the web but because i am pretty new to c# i found nothing waaaay too complex for me I to be able to solve the problem
Posted
Updated 25-Jul-18 21:44pm
Comments
[no name] 26-Jul-18 3:42am    
Show some code; "a dynamic grid" is pretty vague.

(Hint: add "event handlers")

1 solution

Your best option is probably to use a Blend Behavior which is not to complex c# - How to add a Blend Behavior in a Style Setter - Stack Overflow[^].

More advanced users can use their own custom WPF Behaviors, which typically translates a certain event (eg. mouse click) into an invocation of a bound command.

So, you either want to research Blend behaviors if you just want to solve your current problem or WPF behaviors in general if you want to understand more about the technical approach (there really is a lot of content out there).
 
Share this answer
 
v3

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