Three practical tips for Silverlight

Source: Internet
Author: User
Three practical tips for Silverlight today, I watched a video tutorial on the Silverlight discovery journey and found something useful. I will extract it now to share with you what I personally think is quite good. I. DebugSilverlight application method: Method 1: Silverlight reference namespace: System. Diagnost

Three practical tips for Silverlight today, I watched a video tutorial on the Silverlight discovery journey and found something useful. I will extract it now to share with you what I personally think is quite good. I. DebugSilverlight application method: Method 1: Silverlight reference namespace: System. Diagnost

Three practical tips for Silverlight today, I watched a video tutorial on the Silverlight discovery journey and found something useful. I will extract it now to share with you what I personally think is quite good.

I. DebugSilverlight application method:

First:

1. Silverlight reference namespace: System. Diagnostics;

2. Write Debug. WriteLine ("content to be output") where necessary ");

3. When debugging, You can output "content to be output" in the output window"

Second:

1. Reference namespace: System. Windows. Browser;

2. Write HtmlPage. Window. Alert ("alert information") where necessary ");

3. alert can output "alert information" during operation ";

I personally think these two methods are quite good, especially the first one, which is much easier than setting a breakpoint for debugging. If there is no output in that place, it means you know where an error has occurred.

2. Use full screen for Silverlight

1. Reference namespace: System. Windows. Interop;

2. Write ContentmyContent = newContent (); myContent. IsFullScreen =! MyContent. IsFullScreen;

In this way, you can control whether the running program is full screen.

3. Timer

1. Reference namespace: System. Windows. Threading;

2. instantiate the Timer object:

 
 
  1. DispatcherTimertimer=newDispatcherTimer();
  2. timer.Interval=TimeSpan.FromMilliseconds(10);
  3. timer.Tick+=newEventHandler(timer_Tick);
  4. voidtimer_Tick(objectsender,EventArgse)
  5. {
  6. //todo
  7. }

In this way, a timer has been completed.

However, to execute it, you must write timer. Start (); to Stop it, write timer. Stop ();

I think the above three points will be very useful when learning Silverlight, especially the first point. I personally think it may be useful in other development scenarios. I hope you will make great efforts.

Http://www.slfans.com /? Action-viewnews-itemid-17423
Silver Powder-Silverlight enthusiast http://www.slfans.com/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.