views:

70

answers:

2

On Windows Phone 7 to get the current control one would use

FocusManager.GetFocusedElement()

Wherea on Winform it is just ActiveControl.

Why use 2 semantics which is a nuisance for portability ? Is there any difference of behavior you can see between the two ? If yes that makes sense, otherwise that doesn't.

+1  A: 

Development for WP7 as a whole is similar to Desktop-based WPF development. Seeing as MS is keeping WPF to WinPhone7 namespaces consistent, it actually makes sense in a way.

Semyazas
Guess it always makes sense in some way :) but then instead of windows 7 I could have replaced the question with WPF.
I think the whole point is getting more clear on what exactly the state of the control is. Active only means "can be interacted with", whereas focused is a well-defined description. It always depends on viewpoint, and it might be a nuisance if you're used to the Forms Namespace, but if you just happen to start programming for Windows, it's actually less confusing.
Semyazas
+4  A: 

the WP7 api does not stem from Winforms, but from WPF and Silverlight. The question should therefore be why does WPF use GetFocusedElement.

The answer is pretty simple: It was judged more adequate than ActiveControl. What does ActiveControl mean? The active control is the control which has focus. GetFocusedElement seams better to me.

Maupertuis
But hard to remember FocusManager whereas ActiveControl is in default System.Windows.Forms namespace