What should you do?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4. You add a class named CreateOrderCommand in the application. You implement the ICommand interface in the CreateOrderCommand class. You also create a class named CreateOrderVie wModel. You add the following XAML fragment to create a UserControl named CreateOrder. (Line numbers are included for reference only.)
01 <UserControl.Resources>
02 <local:CreateOrderViewModel x:Key=”vm” />
03 </UserControl.Resources>
04
05 <Grid x:Name=”LayoutRoot” DataContext=”{StaticResource vm}” >
06
07 </Grid>
You need to bind the CreateOrderCommand command to a Button control. What should you do?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4. You add a class named CreateOrderCommand in the application. You implement the ICommand interface in the CreateOrderCommand class. You also create a class named CreateOrderVie wModel. You add the following XAML fragment to create a UserControl named CreateOrder. (Line numbers are included for reference only.)
01 <UserControl.Resources>
02 <local:CreateOrderViewModel x:Key=”vm” />
03 </UserControl.Resources>
04
05 <Grid x:Name=”LayoutRoot” DataContext=”{StaticResource vm}” >
06
07 </Grid>
You need to bind the CreateOrderCommand command to a Button control. What should you do?

A.
Create a property named CreateOrder in the codebehind class of the CreateOrder control.
Set the type of the CreateOrder property to CreateOrderCommand.
Add the following XAML fragment at line 06.
<Button Content=”Create” Command=”CreateOrder” />

B.
Create a property named CreateOrder in the codebehind class of the CreateOrder control.
Set the type of the CreateOrder property to CreateOrderCommand.
Add the following XAML fragment at line 06.
<Button Content=”Create” Command=”CreateOrder.CreateOrder” />

C.
Create a property named CreateOrder in the CreateOrderViewModel class.
Set the type of the CreateOrder property to CreateOrderCommand.
Add the following XAML fragment at line 06.
<Button Content=”Create” Command=”{Binding CreateOrder}” />

D.
Create a property named CreateOrder in the CreateOrderViewModel class.
Set the type of the CreateOrder property to CreateOrderCommand.
Add the following XAML fragment at line 06.
<Button Content=”Create” Command=”{Binding CreateOrder.CreateOrder}” />



Leave a Reply 0

Your email address will not be published. Required fields are marked *