Intercepting OrigionalSource
-
Hi Guys, I've got a MyUserControl i have created for my app. When i click on, or mouse over the MyUserControl, i'd like the events to be raised with the MyUserControl as the OrigionalSource. As they are composite controls, made up of numerous other controls, i get whatever child control was clicked inside MyUserControl. How do i go about achiving this? Regards Tristan
------------------------------- Carrier Bags - 21st Century Tumbleweed.
-
Hi Guys, I've got a MyUserControl i have created for my app. When i click on, or mouse over the MyUserControl, i'd like the events to be raised with the MyUserControl as the OrigionalSource. As they are composite controls, made up of numerous other controls, i get whatever child control was clicked inside MyUserControl. How do i go about achiving this? Regards Tristan
------------------------------- Carrier Bags - 21st Century Tumbleweed.
-
Hi Guys, I've got a MyUserControl i have created for my app. When i click on, or mouse over the MyUserControl, i'd like the events to be raised with the MyUserControl as the OrigionalSource. As they are composite controls, made up of numerous other controls, i get whatever child control was clicked inside MyUserControl. How do i go about achiving this? Regards Tristan
------------------------------- Carrier Bags - 21st Century Tumbleweed.
You could make them all global (setting a property for the element in XAML, or when you create them in code. At that point, you can subsribe to those events anywhere you want. I know it's cheating, but it works, and you can't afford to spend a week on this stuff. Right?
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
You could make them all global (setting a property for the element in XAML, or when you create them in code. At that point, you can subsribe to those events anywhere you want. I know it's cheating, but it works, and you can't afford to spend a week on this stuff. Right?
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001Hi, thanks. that got me thinking, and in the end i implemented an ITarget interface on every control i wanted clicked, and looped through the parent controls until I found an implementor. Surely there's a better way.
------------------------------- Carrier Bags - 21st Century Tumbleweed.
-
Hi, thanks. that got me thinking, and in the end i implemented an ITarget interface on every control i wanted clicked, and looped through the parent controls until I found an implementor. Surely there's a better way.
------------------------------- Carrier Bags - 21st Century Tumbleweed.
The "best" way is whatever you can get to work. Remember, your project is late (no matter if it actually is or not). :)
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
The "best" way is whatever you can get to work. Remember, your project is late (no matter if it actually is or not). :)
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001Well, that depends on who's maintaining the "best" way :P
------------------------------- Carrier Bags - 21st Century Tumbleweed.