Sonntag, 16. Oktober 2011

Windows Phone 7: Issue with Textblock and Textbox rendering

There is an issue with Silverlight for Windows Phone if you try to show a Textblock or Textbox with a lot of text. In my current Windows Phone 7 project with have a listbox with comments and with large text sizes (above 3300 in our test cases) we have the effect that the space for the text is rendered but not all characters.

The result looks like this:

 image

This happens if the surrounding container object (for example Grid or Stackpanel) has a defined width and the Textbox or Textblock has the VerticalAlignment set to “Stretch”.

The XAML definition looks like this:

   1:  <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
   2:              <ListBox x:Name="MainListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="MainListBox_SelectionChanged">
   3:                  <ListBox.ItemTemplate>
   4:                      <DataTemplate>
   5:                        <StackPanel Margin="0,0,0,17" Width="432" >
   6:                            <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
   7:                            <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" 
   8:                                       VerticalAlignment="Stretch"
   9:                                       Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
  10:                        </StackPanel>
  11:                      </DataTemplate>
  12:                  </ListBox.ItemTemplate>
  13:              </ListBox>
  14:   </Grid>

The workaround for this problem is to truncate the text after 3300 characters or don’t use a fix width for the container of the Textbox or Textblock element.

The behaviour is the same in Windows Phone 7.0 and Windows Phone 7.1 projects.

Share |

Samstag, 15. Oktober 2011

Windows Phone 7–Mango süßsauer

Windows Phone Mango

 

Mein neuster Artikel in der Mobile Technology ist seit Freitag an den Kiosken erhältlich. Entgegen des Arbeitstitels “Mango süßsauer” geht es hier nicht um asiatische Kochspezialitäten, sondern um eine kurze Darstellung der neusten Features für  Entwickler bei Nutzung der Windows Phone Developer Tools 7.1 für die Entwicklung von “Mango”-Apps. Süßsauer deshalb, weil nicht nur die Neuerungen beschrieben werden, sondern auch ein Auge auf noch Ausbaufähiges zur Windows Phone Entwicklung gelegt wird.

Share |

Dienstag, 27. September 2011

Windows Phone 7.5 Mango–it’s on the way

This morning, at roughly 10 a.m. Pacific time, Microsoft began rolling out the Mango update to phones around the world. Windows Phone 7.5 (aka Mango) has about 500 new features and is a major update for the Windows Phone platform.

Eric Hautala says

”I do want to emphasize that today is just the start. Our plan, as I’ll explain in a moment, is to ramp up delivery gradually—but make the update available to most existing customers within 4 weeks.

I’m sure you have lots of questions about the update process and especially when you’ll be able to install Windows Phone 7.5. Here’s our plan.”

More details see: Windows Phone 7.5 update begins

Share |

Sonntag, 7. August 2011

Windows Phone: New Silverlight toolkit announced

Good news for Windows Phone developers: it's just been announced that the Silverlight Toolkit for Windows Phone will be getting a Mango update sometime in August.

This update will giving developers just a few extra weeks to tweak their Silverlight extensions before the Marketplace starts accepting Mango apps. No word on the exact changes the new toolkit will contain, but I think Jeff Wilcox will give us some goodies in there.

Share |

Samstag, 2. Juli 2011

Windows Phone Mango 80004005 error

Currently my Mango update for Windows Phone fails with error code 80004005.

Answer from Microsoft:

“This is an error that is still being diagnosed at Microsoft.  At this time there is no workaround for it.  You should restore your phone to its NODO image and wait until there is a resolution for this problem.”

Some suggestions from Microsoft

On these crash / update issues there are two general approaches that you can try.


1. Try to apply the update using a different desktop / laptop system.

2. If a different system still doesnt' help, then remove any personal data from the device and perform a hard reset. Then try the update process again

Share |

Montag, 27. Juni 2011

MVC3: Combine JavaScript files

A nice tool on codeplex to combine and minifier several JavaScript files:

Combres - WebForm & MVC Client-side Resource Combine Library – Home

  • Open the Package Manager Console (Tools > Library Package Manager > Package Manager Console)
  • In the command window:
    • If you work with ASP.NET MVC: enter Install-Package Combres.Mvc
    • If you work with ASP.NET WebForm: enter Install-Package Combres

Register Route
This step is only necessary for ASP.NET 3.5 users. ASP.NET 4.0 users can skip to the next step. This step is necessary because there's currently no way to generate/transform/reference different code/config/assemblies for different .NET runtimes with NuGet.
  • Delete the generated file AppStart_Combres.cs
  • Remove the reference to the assembly WebActivator
  • Open global.asax code-behind file
    • Import Combres namespace, i.e. using Combres;
    • Add this to the first line of either RegisterRoutes() or Application_Start(): RouteTable.Routes.AddCombresRoute("Combres");

Modify Combres.xml
  • Open App_Data/Combres.xml (this should be auto-created when you install the Combres NuGet package)
  • Add/remove resource sets, resources etc. as per your need. See this article for more information.

Reference to Combres' resource sets in view
  • Open any view page (e.g. master page) which need to reference JS/CSS resource sets defined in Combres.xml
  • Add the followings:
<%= WebExtensions.CombresLink("siteCss") %>  
<%= WebExtensions.CombresLink("siteJs") %>
Share |

Sonntag, 26. Juni 2011

HTML5: Deprecated Tags

HTML5 has introduced a lot of new fantastic elements that will be helpful to build better web pages. But the specification also deprecates a few tags that you maybe used in your web pages. So keep them in mind and use  the more semantically correct tags or use CSS for styling.

Presentational tags that are deprecated:

  • basefont
  • big
  • center
  • font
  • s
  • strike
  • tt
  • u

Also the support for frames has been removed. That means that the following tags are gone:

  • frame
  • frameset
  • noframes

A few other tags are replaced by better options:

  • acronym replaced by abbr
  • applet replaced by object
  • dir replaced by ul

In addition to deprecated tags there are many HTML attributes that are no longer valid:

  • align
  • link, vlink, alink and text attributes on body tag
  • bgcolor
  • height, width
  • scrolling on the frame element
  • valign
  • hspace, vspace
  • cellpadding, cellspacing, border on the table tag

Deprecated HTML attributes are:

  • target for links
  • profile for head tag
  • longdesc for img and iframe

If you plan on using HTML5 for your website, be sure to look at this elements and attributes to be compatible with the future and HTML5. You can use http://validator.w3.org to validate your page with the standards.

Share |