Feed on
Posts
Comments

I heard this nugget from Derek Lakin on Twitter: 

Press and Hold is  the discovery combination that every Windows phone 7 user should know.

 

We were having a conversation around the Windows Phone 7 on-screen keyboard.  In order to keep the keyboard compact Microsoft stows alternate character beneath common keys.  Take punctuation for example.  On the default alpha keyboard there are two punctuation keys (period and comma).  If you press and hold the period key another set of keys appears.

image

 

This also works for accented (diacritical) characters.

Accented characters on the Keyboard

 

===========================

Huge library of online Silverlight videos.  Why not check it out?

All  Windows Phone 7 applications undergo a security analysis when uploaded to the Windows Phone Marketplace.   The analyzer checks to see what services your app requires and verifies that you have requested those services in the Application Manifest.

Windows Phone provides a capabilities-driven security model where a user must opt-in to certain functionality within the application. For certain scenarios, Windows Phone APIs invoked by applications may require specific security permissions or user disclosure when run. By default, when you create a Windows Phone project, an application manifest file is auto-generated that includes a list of the all the phone capabilities supported by Windows Phone. The Windows Phone operating system will grant security permissions to the application according to the capabilities listed in that manifest file

The Phone SDK includes the Windows Phone Capability Detection Tool to help determine which capabilities to include in the manifest before submitting your application to Microsoft.

Be wary of third party DLLs

Adding references to other DLLs can increase your security footprint. Any access requested in your referenced assemblies is considered part of your application capabilities too. I’ve been working with the AdControl in the Microsoft.advertising.Mobile.UI.dll for a upcoming project.   I noticed that it adds the following capabilities to the required list.

  • ID_CAP_PHONEDIALER
  • ID_CAP_NETWORKING
  • ID_CAP_WEBBROWSERCOMPONENT
  • ID_CAP_IDENTITY_USER

I’m working on a Windows Phone 7 application that is using the Microsoft ad network.  Microsoft simplifies the process by providing an AdControl control in the Advertising SDK.

To add the control to your XAML is easy.

    <my1:AdControl Grid.Row=’0′
                  ApplicationId=‘ba766 etc.’
                  AdUnitId=’100xxxxxxx’
                  Width=’480′
                  Height=’80′
                  HorizontalAlignment=‘Center’
                  VerticalAlignment=‘Center’
/>

Next, you need to configure some ad campaigns on the Microsoft ad  center and add the correct ApplicationId and AdUnitId to your XAML. Now, when the AdControl is shown on the page, you should see it populated with data.

Failure

In our app everything worked correctly for a day or two.  Eventually we noticed that we did not see the ad when testing on the device.   After wasting hours of time  investigating the problem the answer emerged.

You must not disable the ID_CAP_NETWORKING capability in the WMAppManifest.xml

  <Capabilities>

      <Capability Name="ID_CAP_IDENTITY_DEVICE" />
      <Capability Name="ID_CAP_IDENTITY_USER" />
      <Capability Name="ID_CAP_NETWORKING"/>
   </Capabilities>

Failing to set this capability causes the AdControl to fail when connecting to the ad network.  This, in turn, causes the AdControl to collapse in the UI. So no ads.

In hindsight, this makes sense, as the control needs to contact the server.  But this isn’t documented anywhere that I have found.

I’m one of the lucky few to have access to a developer device.  I’m currently using the Samsung Taylor and it is really a nice phone.  I’m looking forward to seeing the production phones, which have a faster processers, more RAM etc.

Having the device is invaluable for debugging and testing.  For example one of the certification requirements is that you app cannot use more the 90MB of memory.  Running on the hardware I stumbled across an interesting limitation while developing a new app.  On the device, going over the memory limit causes the phone to raise a NavigationFailed event when calling NavigationService.Navigate.   See this thread on the phone forums for more information.  I spent too much time debugging the navigation problem, when what I really needed to look at was the massive amount of memory consumed by the Panorama control.  Lesson learned:  pay more attention to the performance counters at every stage of your application cycle.

Built-in counters

You may already know about the counters included in the phone API.  In fact, they are hard to miss in the RTM release.  They are included in the default template, and setup to run when ever you attach a debugger to your phone application. Jeff Wilcox has a lengthy blog post if you want to learn more.

Memory Counters

Unfortunately these counter do not include an important metric.  They are missing memory usage counters.  Not to worry however. Garry McGlennon has released a counter which shows these important stats.

MemoryCounter

I’ve added it to my application and plan on using it during all future development.


Want to watch some Silverlight online training?

Expression Blend is a nice supplemental tool for Visual Studio developers. Blend contains tools that will simplify Silverlight or WPF UI creation. For example, if you want to edit a control template in a WYSIWYG designer, then Blend is the tool for you. There simply is nothing comparable in Visual Studio.

Unfortunately, once you start using Blend you may find yourself struggling with simple tasks. Your favorite Visual Studio shortcuts just won’t work. Take something as innocent as moving your work area around on the screen. In Visual Studio, you probably use the horizontal and vertical scroll bars to do this.

clip_image002

Don’t be too sure that your favorite way to move your work area around on the screen is the best way to accomplish the job in Blend however. Here is a similar screenshot in Blend. As you can see there are scroll bars in the Blend work area too.

By the way, the work area in the center of Blend is called the Artboard.

clip_image004

Borrowing from the Photoshop crowd

Watch a designer working in Photoshop for a few minutes and you will likely see them using the Hand tool. It’s useful for moving the entire image within a Photoshop window. So if you are zoomed in and your work area is larger than the window, the Hand Tool is helpful navigation aid.

Since Blend is targeted toward the designer crowd it’s not surprising to learn that it has a Hand tool available.

clip_image006

Click the Hand on the toolbar (or press the H key) and you can mouse drag anywhere on the artboard. Now you drag in the work area instead of moving to the edges of the screen to find the scrollbars. Personally I think this is a better approach, and I find myself wishing Visual Studio had a similar tool.

Other Hand Tips

Here are a few more Hand tidbits.

  • Double-click the Hand tool on the tool bar to automatically center the artboard.
  • You don’t have to actually select the hand in the toolbar or with the H key. To temporarily switch to the Hand, hold down the Spacebar. Now you can mouse drag the artboard. The benefit to this approach is that the Hand is only toggled on while you hold the spacebar. Once you release the spacebar Blend returns to the previously selected tool.

[Originally posted on TechTarget.com]

You can customize the image shown in your Windows Phone 7 Tile.  All you need to do is change the BackgroundImageURI value in the WMAppManifest.xml file.

  <Tokens>
      <PrimaryToken TokenID="MyAppToken" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" 
                              IsResource="false">
                              /Images/Coins/tileImage.png</BackgroundImageURI>

You can also change this value in the Visual Studio 2010 Property page.

image

Figure 1:  Change Background Image in Property page.

Visual Studio 2010 Bug

Unfortunately there is a bug in Visual Studio.  If you choose the image using the property page the full path the the image to the image is not added to the WMAppManifest.xml.

<BackgroundImageURI IsRelative="true" 
                    IsResource="false">
                 tileImage.png</BackgroundImageURI>

Without the complete path the image won’t show in the applications Tile.

It’s easy to embed information inside your assembly. Just add it to the assemblyInfo.cs/assemblyInfo.vb  file or use the Visual Studio properties window.

image

Reading the AssemblyInfo data

When you want to read this information from a Silverlight/WindowsPhone assembly you can call on the Assembly class to get the desired data.

You can use the GetExecutingAssembly method and the AssemblyName class to find this information.


 
var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);

var version = nameHelper.Version;
var full = nameHelper.FullName;
var name = nameHelper.Name;

[Edit]

Why not use a call to Assembly.GetExecutingAssembly().GetName()?  In the Silverlight API that call throws an exception. 


Silverlight Video Training

Hard coding the size of control is not a good choice in many situations.  If you specify the height of a button and the font size increases you might see the bottom of your text clipped.  If you hard code the width of the button it can’t grow or shrink to accommodate changes in content size.  For example localizing a string in the button may result in a longer word.  And that may cause the end of the string to be truncated.

Here’s a tip that allows one dimension, either height or width to be modified, yet always keeps the content control constrained to a square.

Use a binding to ActualWidth or ActualHeight to force the control to be a square.

Flexible Height, Matching Width

 <Canvas>
    <Button Content='A' Padding='0'
            FontSize='16'
            Width='{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}' />

    <Button Content='A' Padding='0'
            FontSize='60'
            Width='{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}'
            Canvas.Top='40' />

  </Canvas>

image

Figure 1: Changing font size modifies the width.

Flexible Width, Matching Height

<Canvas>
    <Button Content='ABCDEDFG' Padding='0'
            Height='{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}' />

    <Button Content='ABCD' Padding='0'
            Height='{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}'
            Canvas.Top='100' />

  </Canvas>

image

Figure 2: Changing the text content modifies the height.

Windows Phone 7, like most modern touch screen phones, has an on screen keyboard.  It’s known as the Software Input panel (SIP) and it is a virtual keyboard that appears when a text-input control such as a TextBox gets the input focus.

There are 50+ keyboards configurations available.  Figure 1 shows the default keyboard layout.

image

Figure 1: Default SIP

How to input accented (diacritical ) characters

It is simple to input accented and alternate letters if you know the secret.  Press and hold a letter on the SIP to see the available list of alternate characters.

Here are some sample screenshots.

image

image

image

image

image

image

image

image

image

image

I see that Technet radio has a new Silverlight episode.

TechNet Radio: TechNet on: Silverlight @ Work

Listen in as Keith Combs chats with Kevin Dockx, co-author of the new eBook Microsoft Silverlight 4 Data and Services Cookbook.

See how Silverlight stacks up as a tool for creating business applications and how it can integrate with existing applications.

Also find out what the core requirements are for building rich Internet applications.


Learn more about Silverlight 4 with Online Silverlight training

« Newer Posts - Older Posts »