void AddedView(object sender, AddedViewEventArgs e) { NavigationButton button = new NavigationButton(); StackPanel panel = new StackPanel(); TextBlock title = new TextBlock(); title.TextAlignment = TextAlignment.Center; title.Text = e.View.Title; panel.Children.Add(title); Image icon = new Image(); icon.Source = new BitmapImage(new Uri("/Omniscient.Foundation.Contrib.Silverlight;Component/Resources/application_side_boxes.png", UriKind.Relative)); icon.Stretch = Stretch.Fill; ContentControl iconPlaceholder = new ContentControl(); iconPlaceholder.Height = 24.0; iconPlaceholder.Width = 24.0; iconPlaceholder.Content = icon; iconPlaceholder.Margin = new Thickness(3.0); panel.Children.Add(iconPlaceholder); button.Margin = new Thickness(0, 0, 3, 0); button.Content = panel; button.View = e.View; button.Click += new RoutedEventHandler(NavigationButton_Click); StackPanelContent.Children.Add(button); _buttons.Add(button); }
void AddedView(object sender, AddedViewEventArgs e) { NavigationButton button = new NavigationButton(); StackPanel panel = new StackPanel(); TextBlock title = new TextBlock(); title.TextAlignment = TextAlignment.Center; title.Text = e.View.Title; panel.Children.Add(title); Image icon = new Image(); icon.Source = new BitmapImage(new Uri("/Omniscient.Foundation.Contrib.Silverlight;Component/Resources/application_side_boxes.png", UriKind.Relative)); icon.Stretch = Stretch.Fill; ContentControl iconPlaceholder = new ContentControl(); iconPlaceholder.Height = 24.0; iconPlaceholder.Width = 24.0; iconPlaceholder.Content = icon; iconPlaceholder.Margin = new Thickness(3.0); panel.Children.Add(iconPlaceholder); button.Margin = new Thickness(0, 0, 3, 0); button.Content = panel; button.View = e.View; button.Click += new RoutedEventHandler(NavigationButton_Click); StackPanelContent.Children.Add(button); _buttons.Add(button); }
void NavigationButton_Click(object sender, RoutedEventArgs e) { NavigationButton button = (NavigationButton)sender; _navigator.NavigateTo(button.View); }