I am having a go with RxUI within a WinRt project and just seeing if i can get something to work, i suspect that what i am doing is not a valid use case but thought i would ask to be sure.
I have a textbox that is bound to a property, i want to subscribe to the keydown event and prevent the user from inputting inappropriate characters (in this case, anything that is not a number). Due to using MVVM i do not have access to the textbox itself, only the binding values.
Can this still be done? – it seems a little odd to subscribe to property changed and then undoing their input afterwards, if it is undesirable.
This seems to be a UI based concern, so a more loosely-coupled approach would be to write a behavior class (basically an attached property which binds events), and attach it to the textbox in concern.
This way you can actively filter input and not have code-behind specific to that text-box.
Possible representation:
Have a look at: