Getting started with windows store
Step-1: Download windows 8 sdk from Microsoft website
http://msdn.microsoft.com/en-us/library/windows/desktop/hh852363.aspx
Step-2: Select Windows store Apps from file-->New-->Project-->Visual C# -->Windows store
Step-3: Select "MainPage.xaml" file in solution explorer.
You can make use of the TextBlock control for displaying Text on the screen.The TextBlock control has a property called Text that you can set to "Hello World" after press button.
Step-4: Paste this code into your "MainPage.xaml" file
<Page
x:Class="Helloworld.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Helloworld"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Press Me" HorizontalAlignment="Left" Margin="94,76,0,0" VerticalAlignment="Top" Width="192" Height="71" Click="Button_Click_1"/>
<TextBlock x:Name="label1" HorizontalAlignment="Left" Margin="94,175,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="85" Width="211"/>
</Grid>
</Page>Codebehind file
Step-1: Download windows 8 sdk from Microsoft website
http://msdn.microsoft.com/en-us/library/windows/desktop/hh852363.aspx
Step-2: Select Windows store Apps from file-->New-->Project-->Visual C# -->Windows store
Step-3: Select "MainPage.xaml" file in solution explorer.
You can make use of the TextBlock control for displaying Text on the screen.The TextBlock control has a property called Text that you can set to "Hello World" after press button.
Step-4: Paste this code into your "MainPage.xaml" file
<Page
x:Class="Helloworld.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Helloworld"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Press Me" HorizontalAlignment="Left" Margin="94,76,0,0" VerticalAlignment="Top" Width="192" Height="71" Click="Button_Click_1"/>
<TextBlock x:Name="label1" HorizontalAlignment="Left" Margin="94,175,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="85" Width="211"/>
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Helloworld
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
label1.Text = "Hello world!";
}
}
}
Outputusing System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace Helloworld
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
label1.Text = "Hello world!";
}
}
}
Tidak ada komentar:
Posting Komentar