How to set as default the Silverlight 4?

Asked By 0 points N/A Posted on -

I encountered this confusing problem with my Silverlight application.

I already installed Visual Studio 2010 and the default application is Silverlight 3.

I want to upgrade it to Silverlight 4, so I installed it, but Silverlight 3 still shows up as the default application.

Kindly assist me with this problem?

Best Answer by Woods Kent
Answered By 5 points N/A #105944

How to set as default the Silverlight 4?


Hi there Veronica:

Silverlight 3 is a free web browser that doesn’t have an automatic update option. Instead, you will have to install its new version (which is the Silverlight 4). But before you do that, you need to uninstall the previous version of this application (which is the Silverlight 3). Go to the settings of your Explorer and make Silverlight 4 as your default browser. Then restart your explorer.

Thank you for posting.

Best regards,  

Best Answer
Best Answer
Answered By 0 points N/A #105946

How to set as default the Silverlight 4?


Hi ,Veronica Winslet

You want to set as default silverlight 4 , for this you have follow these steps.

First you should find where the backing property was not being updated prior to the button click occurring (as in all MVVM patterns)….

Note: peer.SetFocus();

Edit: Added XAML example.

public static class DefaultButtonService


    public static DependencyProperty DefaultButtonProperty =




                                              new PropertyMetadata(null, DefaultButtonChanged));

    private static void DefaultButtonChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {

        var uiElement = d as UIElement;

        var button = e.NewValue as Button;

        if (uiElement != null && button != null) {

            uiElement.KeyUp += (sender, arg) => {

                var peer = new ButtonAutomationPeer(button);

                if (arg.Key == Key.Enter) {


                    uiElement.Dispatcher.BeginInvoke((Action)delegate {

                        var invokeProv =

                            peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;

                        if (invokeProv != null)







    public static Button GetDefaultButton(UIElement obj) {

        return (Button)obj.GetValue(DefaultButtonProperty);


    public static void SetDefaultButton(DependencyObject obj, Button button) {

        obj.SetValue(DefaultButtonProperty, button);



How to apply in XAML:


    <TextBox DinnerConfig:DefaultButtonService.DefaultButton="{Binding ElementName=MyButton}"

                Text="Press Enter" />

    <Button x:Name="MyButton"

            Content="Click me" />


It works fine for me.

Login/Register to Answer

Related Questions