Test your knowledge

  1. You are developing a Silverlight 4 application that uses commands. When a user clicks a button on the page you need to pass it the selected value of a ComboBox control named cbShapes. What should your button look like?

    a.<Button Content="Get Shape" Command="{Binding GetShapeCommand}" CommandParameter="{Binding SelectedItem, ElementName=cbShapes}"/>

    b.<Button Content="Get Shape" Command="{Binding GetShapeCommand}" CommandParameter="{Binding SelectedValue, ElementName=cbShapes}"/>

    c.<Button Content="Get Shape" Click="{Binding GetShapeCommand}" ClickParameter="{Binding SelectedItem, ElementName=cbShapes}"/>

    d.<Button Content="Get Shape" Command="{Binding GetShapeCommand}"/>

  2. You are writing a Silverlight 4 application that connects to a Windows Communication Foundation (WCF) service. The WCF service is hosted on a domain different from the one running your application. When you run your application, you receive the following error: Page not found. What should you do to resolve the issue?

    a. Place a clientaccesspolicy.xml file in the root of the Silverlight application.

    b. Place a clientaccesspolicy.xml file in the root of the WCF service domain.

    c. Place a clientaccesspolicy.xml file in the ClientBin folder of the web host that runs Silverlight.

    d. Move the WCF web service to the same domain as Silverlight's.

  3. You are writing a Silverlight 4 application that does a heavy calculation job. You decide to move the calculating method to a background thread in order to not have the UI layer freezed while the application calculates. In order to show users the progress of the calculation job, you have added a progress bar to your application—MainPage.xml. You implement the ProgressChanged event handler to update the progress of the calculation to the progress bar. Users complain that no matter how long they wait, the progress bar never fills up and instead they get an exception error. What can be the reason?

    a. You forgot to set the WorkerReportsProgress property of the background worker class to true.

    b. Your job finishes too fast for the progress bar to fill up.

    c. You never fired the DoWork method of the background thread class.

  4. You are writing a Silverlight 4 application with a co-worker. You are tasked with creating a dependency property for your control that will allow users to change the title of the control. Your co-worker wrote the following code:
    Public class MySweetControl : Control
    {
    Public string Title
    {
    Get { return (string)GetValue(TitleProperty);}
    Set { SetValue(TitleProperty, value)}
    }
    }
    

    Which of the following answers is the correct way to write the dependency property itself?

    a. Public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(MySweetControl), new PropertyMetadata(""));

    b. Public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("TitleProperty", typeof(Control), typeof(MySweetControl), new PropertyMetadata(""));

    c. Public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(Control), new PropertyMetadata(""));

    d. Public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("TitleProperty", typeof(string), typeof(MySweetControl), new PropertyMetadata(""));

  5. You are working on a Silverlight 4 application. Your design team has created the UI layer of the application based on the Grid control. You need to dynamically insert a ComboBox control, called cbColors, to the fourth column of the second row of Grid. How will you do that?

    a. Grid.SetRow(cbColors, 4); Grid.SetColumn(cbColors,2)

    b. Canvas.SetRow(cbColors, 2); Canvas.SetColumn(cbColors,4)

    c. Grid.SetRow(cbColors, 1); Grid.SetColumn(cbColors,3)

    d. Grid.SetRow(cbColors, 2); Grid.SetColumn(cbColors,4)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.32.222