Skip to end of metadata
Go to start of metadata

This walkthrough shows you how to create wrapping layout using WrapPanel for wrapping the Image control.

Prerequisites

You need the following components to complete this walkthrough:

  • Visual Studio 2010
  • Silverlight 4 Tools for Visual Studio 2010
  • Intersoft ClientUI 

On this page:

Creating a new ClientUI Application Project

The first step is to create a new ClientUI Application project using Intersoft ClientUI Application project template in Visual Studio.

To create the ClientUI Application project

  1. Start Visual Studio 2010.
  2. Create a new ClientUI Application project using Intersoft ClientUI Application project template. To learn more, see Walkthrough: Create New Intersoft ClientUI Application Template.

To add the resources file

  1. In your project, create new folder with name Images.
  2. In Images folder, copy the images from [Intersoft Installation Folder]\Intersoft WebUI Studio 2010 R1\Samples\SL4\ClientUI Samples\Intersoft.ClientUI.Samples.Assets\Images\Hotels\

Creating Simple Application Using WrapPanel

This section shows you how to create layout using WrapPanel.

  1. First change the d:DesignWidth property to 800 and the d:DesignHeight property to 600 in UXPage.
  2. Add UXWindow control to the LayoutRoot and set the following properties to the control.

    CanMinimizeFalse
    CanMaximizeFalse
    CanCloseFalse
    CanResizeTrue
    HeaderDisplayModeContent
    IsClientVisibleTrue
    IsActiveTrue
    HeaderHotels
    Width700
    Height400
  3. Add UXScrollViewer control to the UXWindow.
  4. Add WrapPanel layout to the UXScrollViewer control.

    XAML
  5. Set Background for WrapPanel using LinearGradientBrush.
  6. Add GradientStop to the LinearGradientBrush and set the Color property to AliceBlue and the Offset property to 1.
  7. Add more GradientStop to the LinearGradientBrush and repeat step 6.

    XAML

  8. Add Border to the WrapPanel and set the Margin property to 10 10 0 0, the BorderBrush property to Black and the BorderThickness property to 1.
  9. Add DropShadowEffect to the Border.
  10. Add Image control to the Border and set the Source property to /CreateWrappingLayoutUsingWrapPanel;component/Images/altira-macau.jpg, the Height property to 150 and the ToolTipService.ToolTip property to Altira macau.

    XAML

  11. Add more Border and Image control to the WrapPanel and repeat step 8-10.

    XAML

  12. Finally, save and run the project. 

After the application is running in the browser, you can try to resize the window you will see the content will follow the size of the window, such as shown in the following figure.

Conclusion

In this walkthrough, you have learned how to create ClientUI project using project template. You also learned how to create the WrapPanel for layouting.

Complete Code Listing

This section lists the complete code used in this walkthrough.

MainPage.xaml

XAML