public MenuItem(MenuData menuData)
 {
     this.id       = menuData.Id;
     this.Caption  = menuData.Caption;
     this.subItems = new List <MenuItem>();
     //OnSelected = new DelegateCommand(ShowMessage, CanShowMessage);
 }
        public void AddMenuItem(MenuData data)
        {
            var item = new MenuItem(data);

            if (!string.IsNullOrEmpty(data.Uri))
            {
                item.Command      = new DelegateCommand <string>(Navigate);
                item.CmdParameter = data.Uri;
            }
            if (data.ParentId != 0)
            {
                MenuItem parent = allMenuItems.Find(x => x.Id == data.ParentId);
                if (parent != null)
                {
                    item.Parent = parent;
                    parent.AddSubMenu(item);
                }
            }

            this.allMenuItems.Add(item);
        }