Windows Phone 7 InputScope in Visual Studio and Blend

Lately I have been working a bit on a couple of Windows Phone 7 apps, and I found a couple of interesting things along the way. I am going to try to blog more frequently soon, and try to cover as much of the interesting stuff as I can find. But it will have to wait until after TechEd New Zealand. But if you happen to be going to TechEd Australia or New Zealand, don’t forget to come to one of my talks and say hi.

Anyhow, the funky problem I am going to write about today is around a feature called InputScopes. On the phone, you can configure your TextBoxes to use different InputScopes. The InputScope defines which of the different software keyboards to use when writing in the TextBox. This is a really cool feature as it helps the user to write the type of info he/she is supposed to provide. It can be things like numbers or currency or chat. Each InputScope results in a different keyboard. Or at least some of them do. There seems to be more InputScopes than cool keyboards at the moment though…

So, what is the problem? Well…there are several different syntaxes for defining InputScope. Visual Studio accepts a nice short syntax that looks like this

<TextBox InputScope="Chat" />

 

Or the slightly more verbose

<TextBox>
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Chat" />
</InputScope>
</TextBox.InputScope>
</TextBox>

 

So…why would you go for that long syntax? Well it gives you some sweet IntelliSense help when setting the NameValue attribute. So you don’t have to know what the name of the InputScope is by heart.

If you however use the verbose syntax markup in your XAML and open it in Blend, Blend chokes and gives you an error message saying Invalid XAML. And even if you don’t get IntelliSense in VS when editing the XAML and using the shorter syntax, you still get all the help you need if you use Blend. So use Blend for you UI and VS for your code…

Pingbacks and trackbacks (1)+

Comments are closed