protected virtual void OnMenuItemClick(ContextMenuItem sender, MenuItemClickEventArgs e)
 {
     if (MenuItemClickHandler != null)
     {
         MenuItemClickHandler(sender, e);
     }
 }
        void MenuItem_Clicked(object sender, MenuItemClickEventArgs e)
        {
            ContextMenuItem item = sender as ContextMenuItem;

            if (item != null)
            {
                OnMenuItemClick(item, e);
                CurrentState = _STATE_DELAYHIDE;
                VisualStateManager.GoToState(this, _STATE_DELAYHIDE, false);
            }
        }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ESRI.SilverlightViewer;component/Widgets/TOCWidget.xaml", System.UriKind.Relative));
     this.MapContentTree   = ((System.Windows.Controls.TreeView)(this.FindName("MapContentTree")));
     this.ContextMenuBlock = ((System.Windows.Controls.Border)(this.FindName("ContextMenuBlock")));
     this.MenuItemZoomTo   = ((ESRI.SilverlightViewer.Controls.ContextMenuItem)(this.FindName("MenuItemZoomTo")));
     this.MenuItemShowAll  = ((ESRI.SilverlightViewer.Controls.ContextMenuItem)(this.FindName("MenuItemShowAll")));
     this.MenuItemShowNon  = ((ESRI.SilverlightViewer.Controls.ContextMenuItem)(this.FindName("MenuItemShowNon")));
 }