PrepAway - Latest Free Exam Questions & Answers

Which code segment you add at line 03?

You are developing an application by using Silverlight 4 and Microsoft .NET Framework 4.
You add the following code segment. (Line numbers are included for reference only.)

01 public class MyControl : Control
02 {
03
04 public string Title
05 {
06 get { return (string)GetValue(TitleProperty); }
07 set { SetValue(TitleProperty, value); }
08 }
09 }

You need to create a dependency property named TitleProperty that allows developers to set the Title. You also need to ensure that the default value of the TitleProperty
dependency property is set to Untitled. Which code segment you add at line 03?

PrepAway - Latest Free Exam Questions & Answers

A.
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(“Untitled”, typeof(string), typeof(MyControl), null);

B.
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(“Untitled”, typeof(string), typeof(MyControl), new PropertyMetadata(“Title”));

C.
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(“Title”, typeof(string), typeof(MyControl), new PropertyMetadata(“Untitled”));

D.
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(“Title”, typeof(string), typeof(MyControl),
new PropertyMetadata(new PropertyChangedCallback((depObj, args) => { depObj.SetValue(MyControl.TitleProperty, “Untitled”); })));


Leave a Reply