How to set the HTML string in the webbrowser control in Windows Phone in MVVM context

The webbrowser control in Windows Phone can display HTML contained in a string. Unfortunately, this can't be done directly via binding, you have to use the NavigateToString(string) method and this can't be used in a full MVVM context !!

To be full MVVM compliant, you can create a new DependencyObject with a DependencyProperty.

  • Create a new class called BindingWebBrowser which inherit from DependencyObject, and create a new DependencyProperty for the HTMLString.
    public class HtmlStringBinding : DependencyObject
    {
        public static readonly DependencyProperty HtmlStringProperty =
            DependencyProperty.RegisterAttached(
            "HtmlString",
            typeof(string),
            typeof(HtmlStringBinding),
            new PropertyMetadata(OnHtmlStringPropertyChanged));
    
        private static void OnHtmlStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != e.OldValue)
            {
                WebBrowser wb = (WebBrowser)d;
                wb.NavigateToString((string)e.NewValue);
            }
        }
    
        public static void SetHtmlString(DependencyObject obj, string html)
        {
            obj.SetValue(HtmlStringProperty, html);
        }
    
        public static string GetHtmlString(DependencyObject obj)
        {
            return (string)obj.GetValue(HtmlStringProperty);
        }
    }
  • And that's it, you can now put the WebBrowser control in the page and add the binding to the DependencyProperty !
<phone:WebBrowser Ctrls:HtmlStringBinding.HtmlString="{Binding HtmlVale}" />



Enjoy !

SQL Azure - Backup

There are many tools and strategies for backup in Windows Azure and SQL Azure. Don't forget that Microsoft has recently added the Import / Export functionnality in the SQL Azure portal.

To perform a backup for SQL Azure, the following tools can be used:

You can also used the following techniques:

Enjoy !

Windows Phone 7.5 Training Kit

The new Windows Phone 7.5 Training Kit for Mango is right now available on MSDN.

You can download it here: http://www.microsoft.com/download/en/details.aspx?id=28564

Techdays 2012

Hi, the techdays 2012 in Paris is comming !!!

You can right now check the program:

See you there !

Lync 2010 for Windows Phone is available !

Lync 2010 for Windows Phone is now available in the market place !!

You can find it on http://www.windowsphone.com/en-US/apps/9ce93e51-5b35-e011-854c-00237de2db9e

Unfortunately, your Lync Server should be well configured to work with. You can enable it, like described here: http://msunified.net/2011/12/12/enabling-lync-mobility/

Enjoy !

Silverlight 5 RTM

Silverlight 5 RTM is available, and good news, SL 5 is supported until 2021 !! Yeah, 10 years of support !

You can find the sdk here: http://www.microsoft.com/download/en/details.aspx?id=28358 and the support information: http://support.microsoft.com/lifecycle/?p1=16278

Enjoy !

Market place: Private submission for enterprise

Hi,

During the last Mix 11 at Las Vegas, Microsft announced that the marketplace will be available for private publication, like an enterprise market place.

Unfortunatly, on the first page when you publish your app, you only have 2 checkboxes: Public and Beta. But, where is the private publication ?

It's simple, and not very well documented, you have to go to the latest step to show this small option: As soon as it's certified make it hidden !!

This is the solution !

 

 

Link: http://create.msdn.com/en-US/home/about/app_submission_walkthrough_submit

Hi there !

 

Specialized in .net technologies for many years, I am a technology fan in both asp.net and wpf/silverlight, using c# and .net 4.5

Taking advantages of new opportunities offered by the Windows Azure platform and WP/Win 8, I develop applications for Windows Phone, 5 of them are already available on the market place.


 

 

Month List