Performance tips for Metro style XAML apps
-
Thursday, May 24, 2012 9:19 PM
The XAML framework has been designed with performance in mind so that it’s easy for you to provide the user with a fast and fluid experience. We’ve written a white paper to explain some best practices for working with the framework to optimize performance. Instead of just giving advice on techniques to optimize traditional perf metrics, this paper gives you some tips grouped by the most important end user experiences they improve. You can find it at the link below.
http://msdn.microsoft.com/en-us/library/windows/apps/Hh750313.aspx
- Edited by Rob CaplanMicrosoft Employee, Moderator Wednesday, October 17, 2012 2:37 AM updated link
All Replies
-
Wednesday, October 24, 2012 6:22 PMHelpful info! Many thanks!
We create delicious software http://verysoftware.com
-
Thursday, November 08, 2012 11:38 PMusing System.Collections;
using System.Windows.Threading;
namespace RandomExample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
///
public partial class MainWindow : Window
{
private ArrayList teamList = new ArrayList();
private ArrayList usedNumber = new ArrayList(); // could just use the TeamList arrlaylist and check there
private int teamCount = 0;
private DispatcherTimer timer;
public MainWindow()
{
InitializeComponent();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Tick += new EventHandler(timer_Tick); // wiring tick event to a handler
timer.Start();
// to stop the timer at any time use timer.Stop;
}
private void timer_Tick(object sender, EventArgs e)
{
// what ever code you put in here will be executed every 1000 milliseconds
this.Title = DateTime.Now.ToLongTimeString();
}
private bool Check(int randomIndex)
// method to check if number used already
{
bool used = false;
if (usedNumber.Contains(randomIndex))
used = true;
return used;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
string[] TeamNames = { "reds", "blacks", "blues", "yellows", "greens" };
Random random = new Random(DateTime.Now.Millisecond);
bool used;
int randomIndex = random.Next(0, 5); // generate a random score between 0 and 4
used = Check(randomIndex);
while ((used == true) && teamCount < 5)
{
randomIndex = random.Next(0, 5);
used = Check(randomIndex);
}
usedNumber.Add(randomIndex);
string randomName = TeamNames[randomIndex]; // pull out the team
int randomScore = random.Next(0, 21); // generate a random score between 0 and 20
if (teamCount < 5) // check that only 5 teams
{
Team aTeam = new Team();
aTeam.TeamName = randomName;
aTeam.Score = randomScore;
teamCount++;
listBox1.Items.Add(aTeam);
teamList.Add(aTeam);
}


