Step 2 of 3: Adding Popup for Windows Phone to your Project

In the previous step you created a new Windows Phone Application. In this step you'll add code to your application to finalize the application.

Complete the following steps:

1.   In the XAML window of the project, place the cursor between the <Grid x:Name="ContentPanel"></Grid> tags and click once.

2.   Add the following XAML markup cursor between the <Grid x:Name="ContentPanel"></Grid> tags to add a StackPanel containing a Button to the application:

<StackPanel VerticalAlignment="Center">

    <Button Content="Open Popup" Height="72" HorizontalAlignment="Center" Margin="10,10,0,0" Name="btnOpen" VerticalAlignment="Top" Width="200" Click="btnOpen_Click" />

</StackPanel>

Note that you'll add code for the button's Click event handler later.

3.   Add the following markup between the </StackPanel> and </Grid> tags to add a C1Popup control with content to your application:

<c1:C1Popup x:Name="c1Popup1">

    <!--Content here-->

    <StackPanel>

        <TextBlock Text="Select an option:" Margin="15" />

        <RadioButton x:Name="radio1" Content="Option 1" />

        <RadioButton x:Name="radio2" Content="Option 2" />

        <RadioButton x:Name="radio3" Content="Option 3" />

        <Button Content="Close Popup" Width="200" x:Name="btnClose" Click="btnClose_Click" />

    </StackPanel>

</c1:C1Popup>

Note that the C1Popup control contains text and buttons. In the next steps you'll add code to initialize one of the buttons.

Your complete markup will appear like the following:

      XAML Markup

4.   Select View | Code to switch to Code view.

5.   Add the following Click event handler to the code:

      Visual Basic

      C#

These buttons will open and close the C1Popup control.

In this step you added the C1Popup control your application. In the next step you'll run the application and observe run-time interactions.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.