public Nav() { this.InitializeComponent(); instance = this; NavItem.NumItems = 0; Sections.Children.Add(new NavItem("Welcome", typeof(Welcome))); Sections.Children.Add(new NavItem("Home", typeof(Home))); Sections.Children.Add(new NavItem("Account", typeof(Account))); Sections.Children.Add(new NavItem("Portfolio", new Portfolio())); Sections.Children.Add(new NavItem("Orders", new Order())); Sections.Children.Add(new NavItem("Quotes/Trade", new Quotes())); Sections.Children.Add(new NavItem("Config", new Configuration())); Sections.Children.Add(new NavItem("Glossary", typeof(Glossary))); Sections.Children.Add(new NavItem("Login/Logout", new Login())); TradeSection = new NavItem("Trade", typeof(Trade)); OrderSection = new NavItem("Order", typeof(Order)); RegisterSection = new NavItem("Register", typeof(Register)); for (int i = 0; i < Sections.Children.Count; i++) { (Sections.Children[i] as NavItem).Click += new EventHandler(onClickNav); } }
void onClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (SelectedItem == this) return; if (SelectedItem != null) DeSelect.Begin(SelectedItem); Select.Begin(this); SelectedItem = this; Click(this, e); }
public void Activate() { if (SelectedItem != this) { if (SelectedItem != null) DeSelect.Begin(SelectedItem); Select.Begin(this); SelectedItem = this; } Click(this, null); }
void onClickNav(object sender, EventArgs e) { SelectedItem = sender as NavItem; ChangeSection(this, e); }