PrepAway - Latest Free Exam Questions & Answers

Which XAML fragment or code segment should you use?

You are developing a browser hosted application by using Silverlight 4. The application runs in partial trust and uses the copy and paste functionality.
The application contains the following XAML fragment.
<TextBox x:Name=”textBoxClipBoard” />
You need to retrieve the contents of the Clipboard and display the contents in the TextBox. Which XAML fragment or code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public MainPage()
{
InitializeComponent();
textBoxClipBoard.Text = Clipboard.GetText();
}

B.
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
textboxClipboard.Text = Clipboard.GetText();
}

C.
<Button x:Name=”btnGetClipboard” Content=”Get Clipboard” Click=”btnGetClipboard_Click”></Button>
private void btnGetClipboard_Click(object sender, RoutedEventArgs e)
{
textboxClipboard.Text = Clipboard.GetText();
}

D.
<Button x:Name=”btnGetClipboard” Content=”Get Clipboard” Click=”btnGetClipboard_Click”></Button>
private void btnGetClipboard_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(textboxClipboard.Text);
}


Leave a Reply