Learning Silverlight 2 Series (10): Using User controls

Source: Internet
Author: User
Tags silverlight

This is the 10th article in the series, which describes the use of user controls in Silverlight 2.

Creating a User Control

In Silverlight 2, we can add a new user control based on the development of custom controls or the creation of user controls to achieve the purpose of control reuse:

To write user control implementation code:

<Grid x:Name="LayoutRoot" Background="White">
   <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        Opacity="0.7" Fill="#FF8A8A8A"/>
  <Border CornerRadius="15" Width="400" Height="150" Background="LightPink" Opacity="0.9">
     <StackPanel Orientation="Horizontal" Height="50">
       <Image Source="info.png" Margin="10 0 0 0"></Image>
      <Button Background="Red" Width="120" Height="40"
           Content="OK" Margin="10 0 0 0" FontSize="18"/>
      <Button Background="Red" Width="120" Height="40"
          Content="Cancel" Margin="50 0 0 0" FontSize="18"/>
     </StackPanel>
  </Border>
</Grid>

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.