Why do you use InputDevice ?

Feb 11, 2009 at 11:16 AM
Hi,
I saw that doing your own InputDevice by deriving from InputDevice is not a supported use case from Microsoft (most classes for this are internal).
In your code you seem to use a lot of reflection to access internal classes of WPF, then I'm wondering why do you choose this solution ? To me, you can just get hit contacts in a window from the service, then you just have to raise events of MultiTouchScreen using HitTesting.
I don't understand why you need to use InputDevice, could you tell me ?
Thanks, 
Coordinator
Feb 17, 2009 at 6:18 PM
Because WPF input system is based on InputDevice and InputManager. I have tried to integrate MTV as much as possible in WPF. Maybe some thing can be made without reflection.
Also it allows me to automaticaly generate PreviewXXX events.
Feb 17, 2009 at 7:42 PM
Well, I'm not sure. I will try to re write MultiTouchScreen without using InputManager or InputDevice, and I think it's not a big deal because the only thing I have to do is to catch contact events from your service, get the target thanks to hit test and then raise tunneling event and bubbling event on the target.

Using reflection to access internal .NET classes is a bit dangerous, because microsoft does'nt garantee that you code will not break during an update of the .NET framework. And you don't seem to use in your code methods exposed by your custom InputDevice.

Stop me if I've missed something.

I will try, if it works I'll let you know, and will send a patch as soon as it works.
Thanks :)
Coordinator
Feb 19, 2009 at 11:00 AM
I agree with you concerning reflection usage. I will try to change this in the future.
It appears that Surface SDK also uses InputDevice, so I think I have chosen the right way :)