Which code segment should you write in the load event of the window?

You are developing a Silverlight 4 application. The application contains a window that has a TextBlock named TxtHeading. The application also has a font named MyFont in a file named MyFont.otf. MyFont.otf is located in the root folder of the Web application that hosts the Silverlight application. You need to dynamically load the font file and use it to display the contents of TxtHeading. Which code segment should you write in the load event of the window?

You are developing a Silverlight 4 application. The application contains a window that has a TextBlock named TxtHeading. The application also has a font named MyFont in a file named MyFont.otf. MyFont.otf is located in the root folder of the Web application that hosts the Silverlight application. You need to dynamically load the font file and use it to display the contents of TxtHeading. Which code segment should you write in the load event of the window?

A.
var client = new WebClient();
client.DownloadStringCompleted += (s, args) =>
{
TxtHeading.FontFamily = new FontFamily(args.Result);
;}
client.DownloadStringAsync(new Uri(@”..\MyFont.otf”, UriKind.Absolute));

B.
var client = new WebClient();
client.DownloadStringCompleted += (s, args) =>
{
TxtHeading.FontFamily = new FontFamily(args.Result);
;}
client.DownloadStringAsync(new Uri(@”..\MyFont.otf”, UriKind.Relative));

C.
var client = new WebClient();
client.OpenReadCompleted += (s, args) =>
{
TxtHeading.FontSource = new FontSource(args.Result); TxtHeading.FontFamily = new
FontFamily(“MyFont”);
;}
client.OpenReadAsync(new Uri(@”..\MyFont.otf”, UriKind.Absolute));

D.
var client = new WebClient();
client.OpenReadCompleted += (s, args) =>
{
TxtHeading.FontSource = new FontSource(args.Result); TxtHeading.FontFamily = new
FontFamily(“MyFont”);
;}
client.OpenReadAsync(new Uri(@”..\MyFont.otf”, UriKind.Relative));



Leave a Reply 0

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