Greece Mobile Team Meetup Photos

It was the best team meetup!

Around the Hill

The mobile team had our second meetup of the year in Anavyssos, Greece last week. It was one of my favorite team meetups so far. We rented a villa that had a ton of rooms as well as a bunch of fun stuff to do including a giant pool and bikes to ride around on. It was really hot but we managed OK. The Mobile Team is up to 12 now and is a great group to work and hang out with. My favorite part of the trip was when we took a day trip to Athens and a walk up to the Acropolis. Second favorite was sailing in the Mediterranean! Check out the pics:

View original post

Camminando sul tetto dei Monti Ernici

Alcune foto dell’escursione sul “Tetto dei Monti Ernici”. Il percorso, abbastanza inusuale, ha visto il faticoso “attacco” a Monte Fragara (2005m) da Prato di Campoli attraverso la ripida “Costa dei fiori”, per poi proseguire cresta fino a Monte Passeggio (2064) e Pizzo Deta (2045m).

Traccia GPS disponibile qui

Un grazie speciale a Vincenzo e Daniele per le foto.

Edit long content of text in Win Phone 7

There are many scenarios where you need to display and edit long chunck of text in your WP7 application.
Editing text is easy with TextBlock, but there are problems when the content you’d edit is longer than approx. 2000 characters, since any UI element that must be displayed beyond the area which is larger than 2048×2048 pixels would be clipped by the platform. If you try that, you will see that the size of the TextBlock is still as if it contains all the characters, but the bottom of it is just blank.

Display long content of text
There are different work arounds to this limitation, that are pretty simple to implement if you just need to display text:
1. Break out the text into a separate blocks, and create a TextBlock for each of this text blocks (details here:
2. Just use a WebBrowser control, load the content into a simple HTML document string, and display it on the screen.

Edit long content of text
Editing the content instead is not that easy as displaying it.
You can see an implementation of the text editor I’m going to explain below in Evernote app, and soon in the WordPress app. Basically you should do the following:

  • Use a WebBrowser control
            <phone:WebBrowser x:Name="browser"
                              Style="{StaticResource BrowserBoxStyle}"
                              Margin="15,10,15,10" Height="Auto" Width="Auto">

    Remember to set IsScriptEnabled="True".

  • Create a template HTML document with a div tag in it, that has the contentEditable=true.
  • Load the content into a string, and if targeting WinPhone 7.1 you even need to replace any character that doesn’t fall in the ASCII character set with their numeric entity.Major details here, and here.
  • Include the content into the template and use the method browser.NavigateToString(content);

To retrieve the edited content call innerHTML on the HTML element that holds it. You can define a JS method and call it from C#.
Below is an example of JS function that returns the content of the text available in the div.

      function getContent() {
           return document.getElementById("example-one").innerHTML;

And you can call the JS function from C# code with a simple method like the one below:

object result = browser.InvokeScript("getContent");

Just for the record, it’s possible to call any JS function, even with parameters, as shown below:

object[] parameters = new object[] { 'parameters list here' };
object result = browser.InvokeScript("name of the JS function", parameters.Select(c => c.ToString()).ToArray());

It’s even possible to add a toolbar/menu in the PhonePage (XAML/C#), and call JS methods that programmatically modify the content of text.
C# button -> C# events handler function -> JS function -> execCommand.