Silverlight: If you call different controls in the Silverlight project

Source: Internet
Author: User

There are no projects recently, and there is plenty of time to start learning Silverlight.

After the Silverlight project is added to the project, several download demos are added to try out the results. The first step is stuck, after multiple controls are added to a Silverlight project, the default call is always in the mianpage. After reading some information, it is found that parameters must be passed in the object that calls Silverlight, then, the app accepts the parameters and determines which control to call based on the parameters.

  1. <Object Data="Data: Application/X-Silverlight ," ID="Xamlobject" Type="Application/x-silverlight-2" 
  2. Width="100%" Height="100%"> 
  3. <Param Name="Source" Value="Clientbin/silverlighttest11.0.xap" /> 
  4. <Param Name="Onerror" Value="Onsilverlighterror" /> 
  5. <Param Name="Background" Value="White" /> 
  6. <Param Name="Minruntimeversion" Value="3.0.40818.0" /> 
  7. <Param Name="Autoupgrade" Value="True" /> 
  8. <Param Name="Initparams" Value="Id = 12343, name = Silverlight learning" /> 
  9. <A Href="Http://go.microsoft.com/fwlink? Linkid = 149156 & V = 3.0.40818.0" Style="Text-Decoration: none ;"> 
  10. <IMG SRC="Http://go.microsoft.com/fwlink? Linkid = 108181" ALT="Getting Microsoft Silverlight" 
  11. Style="Border-style: none" /> 
  12. </A> 
  13. </Object> 

 

  1. Private VoidApplication_startup (ObjectSender, startupeventargs E)
  2. {
  3. Mainpage main =NewMainpage ();
  4. This. Rootvisual = Main;
  5.  
  6. Foreach(StringItemInE. initparams. Keys)
  7. {
  8. Main. ListBox. Items. Add (NewTextblock ()
  9. {
  10. TEXT = string. Format ("Webpage parameters: {0 }={ 1 }", Item, E. initparams [item])
  11. });
  12. }
  13. }

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.