Introduction



Home Screen :

Name of Experiment : Basic Input and Output

Exp No : WP1

Background : Student should require a basic knowledge of C#.

Summary : After going through this experiment, student should be able to understand, how to fetch the input from the user and displaying it as an output on the screen.

Learning Objective : To explain the process of getting an input from the user and display it on the mobile screen.

Target

Target Platform : This application is tested on Windows Phone Emulator and Windows Phone (Lumia 800).

Procedure

Source Code


MainPage.xaml

<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ExperimentTitle" Text="Exp. No WP1" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Basic Input Display" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Home Screen" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock Height="72" HorizontalAlignment="Left" Margin="12,42,0,0" Name="textBlock1" Text="Input Text" VerticalAlignment="Top" Width="153" />
<TextBox Height="72" HorizontalAlignment="Left" Margin="126,42,0,0" Name="textBox1" Text="" VerticalAlignment="Top" Width="324" />
<TextBlock Height="100" HorizontalAlignment="Left" Margin="135,166,0,0" Name="textBlock2" TextWrapping="Wrap" FontSize="20" FontWeight="ExtraBold" VerticalAlignment="Top" Width="324" />
<Button Content="Display" Height="72" Click="button1_Click" HorizontalAlignment="Left" Margin="216,282,0,0" Name="button1" VerticalAlignment="Top" Width="160" />
</Grid>
<TextBlock Height="72" HorizontalAlignment="Left" Margin="12,166,0,0" Name="textBlock3" Text="Output Text" VerticalAlignment="Top" Grid.Row="1" />
</Grid>

MainPage.xaml.cs
using System.Windows;
using Microsoft.Phone.Controls;
using System;

namespace WP2._1
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
String str = textBox1.Text;
textBlock2.Text = str;

}
}
}





Snapshots




Observation

Observation : Now, student can use this experiment in various ongoing applications wherever they are required to get an input from the user.

Video Link

For Windows Phone

Download

Right Click Here And Select Save Target For Entire Download :

I/O Dispay Experiment