protected override void OnNavigatedTo(NavigationEventArgs e)
{
// call default behaviour
base.OnNavigatedTo(e);
// clear form fields
mContent.Children.Clear();
// if results have been passed copy them to form fields
if (results != null) {
StackPanel typePanel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 40) };
TextBlock typeLabel = new TextBlock() { Text = "Result Type: " + resultsType, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap, FontSize = 27 };
typePanel.Children.Add(typeLabel);
mContent.Children.Add(typePanel);
foreach (var key in results.Keys) {
if (key != null && results[key] != null) {
StackPanel panel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 20) };
TextBlock label = new TextBlock() { Text = key, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap };
TextBox textbox = new TextBox() { Text = results[key].ToString(), HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap };
panel.Children.Add(label);
panel.Children.Add(textbox);
mContent.Children.Add(panel);
}
}
} else {
StackPanel typePanel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 40) };
TextBlock typeLabel = new TextBlock() { Text = "No results found", HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap, FontSize = 27 };
typePanel.Children.Add(typeLabel);
mContent.Children.Add(typePanel);
}
}