İpucu

Merhaba arkadaşlar bu yazımda Windows Phone uygulamalarınız için Tiles kullanımını anlatacağım.

  • File> New >Project diyoruz.
  • Silverlight for Windows Phone seçeneğini seçiyoruz.
  • Projenin adı “WindowsPhoneApplicationTiles” yazıyoruz.
 
şimdi kod kısımlarını yazıyoruz.

<Grid x:Name=”ContentPanel” Grid.Row=”1″ Margin=”12,0,12,0″>
< Button Content=”varsayılan” Height=”226″ HorizontalAlignment=”Left” Margin=”86,48,0,0″Name=”button1″ VerticalAlignment=”Top” Width=”300″ Click=”button1_Click” />
<Button Content=”Kullanızı tanımlı” Height=”226″ HorizontalAlignment=”Left” Margin=” 86,0,0,88″Name=” button2″ VerticalAlignment= Bottom” Width=”300″ Click=” button2_Click” />
< /Grid>

şimdi de MainPage.xaml code kısmını yazıyoruz.
 

Code

<phone:PhoneApplicationPage
x:Class=”F5debugWp7Tiles.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
xmlns:phone=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone”
xmlns:shell=”clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone”
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
mc:Ignorable=”d” d:DesignWidth=”480″ d:DesignHeight=”768″
FontFamily=”{StaticResource PhoneFontFamilyNormal}”
FontSize=”{StaticResource PhoneFontSizeNormal}”
Foreground=”{StaticResource PhoneForegroundBrush}”
SupportedOrientations=”Portrait” Orientation=”Portrait”
shell:SystemTray.IsVisible=”True”>

<!–LayoutRoot is the root grid where all page content is placed–>
<Grid x:Name=”LayoutRoot” Background=”Transparent”>
<Grid.RowDefinitions>
< RowDefinition Height=”Auto”/>
<RowDefinition Height=”*”/>
< /Grid.RowDefinitions>

<!–TitlePanel contains the name of the application and page title–>
<StackPanel x:Name=”TitlePanel” Grid.Row=”0″ Margin=”12,17,0,28″>
< TextBlock x:Name=”PageTitle” Text=”Tiles kullanımı” Margin=”9,-7,0,0″ Style=”{StaticResourcePhoneTextTitle1Style}”/>
< /StackPanel>

<!–ContentPanel – place additional content here–>
<Grid x:Name=”ContentPanel” Grid.Row=”1″ Margin=”12,0,12,0″>
< Button Content=”Default” Height=”226″ HorizontalAlignment=”Left” Margin=”86,48,0,0″Name=”button1″ VerticalAlignment=”Top” Width=”300″ Click=”button1_Click” />
<Button Content=”User Define” Height=”226″ HorizontalAlignment=”Left” Margin=”86,0,0,88″ Name=”button2″
< /Grid>
</phone:PhoneApplicationPage>

şimdi de MainPage.xaml.cs içindeki kaynak kodlarını düzenleyelim sayın arkadaşlar :)

Code

private void button1_Click(object sender, RoutedEventArgs e)
{
ShellTile AppShell = ShellTile.ActiveTiles.First();
StandardTileData AppTile = new StandardTileData();
AppTile.Title = ”App1″;
AppTile.BackgroundImage = new Uri(“RedTile.jpg”, UriKind.Relative);
AppTile.Count= 10;
var URINav1 = ”/Page2.xaml?state=App Tile”;
ShellTile.Create(new Uri(URINav1, UriKind.Relative), AppTile);
AppShell.Update(AppTile);
}

private void button2_Click(object sender, RoutedEventArgs e)
{
StandardTileData SecTitle = new StandardTileData();
SecTitle.Title = ”UserApp”;
SecTitle.BackgroundImage = new Uri(“BlueTile.jpg”, UriKind.Relative);
SecTitle.Count = 70;
var URINav = ”/Page1.xaml?state=Sec Tile”;
ShellTile.Create(new Uri(URINav, UriKind.Relative), SecTitle);
}

 

 

MainPage.xaml.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;namespace WindowsPhoneApplicationTiles
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
ShellTile AppShell = ShellTile.ActiveTiles.First();
StandardTileData AppTile = new StandardTileData();
AppTile.Title = “uygulama”;
AppTile.BackgroundImage = new Uri(“RedTile.jpg”, UriKind.Relative);
AppTile.Count = 10;
var URINav1 = “/Page2.xaml?state=App Tile”;
ShellTile.Create(new Uri(URINav1, UriKind.Relative), AppTile);
AppShell.Update(AppTile);
}
 
private void button2_Click(object sender, RoutedEventArgs e)
{
StandardTileData SecTitle = new StandardTileData();
SecTitle.Title = “kullanıcı uygulaması”;
SecTitle.BackgroundImage = new Uri(“BlueTile.jpg”, UriKind.Relative);
SecTitle.Count = 70;
var URINav = “/Page1.xaml?state=Sec Tile”;
ShellTile.Create(new Uri(URINav, UriKind.Relative), SecTitle);
}
}
}
 
şimdi de uygulamamızı çalıştıralım ve “varsayılan” adlı buttonumuzu tıklayalım.
 
 
şimdi de “kullanıcı tanımlı” adlı buttonumuza tıklayalım ve Tiles farklarını görelim..
 
 
şimdilik bukadar, diğer makalelerde görüşmek üzere...