internal void AddItem(HamburgerMenuItem item)
 {
     if (item != null)
     {
         items.Add(item);
         item.Checked += OnItemChecked;
     }
 }
Пример #2
0
        private void CacheHamburgerMenuItems()
        {
            foreach (var item in Items)
            {
                HamburgerMenuItem menuItem = null;
                if (item is HamburgerMenuItem)
                {
                    menuItem = item as HamburgerMenuItem;
                    if ((int)menuItem.IconWidth == 0)
                    {
                        menuItem.IconWidth = CompactPaneWidth;
                    }

                    if (ItemsSource == null || !ItemsSource.GetEnumerator().MoveNext())
                    {
                        var newFeed = new ItemFeed
                        {
                            Command     = menuItem.Command,
                            IconContent = menuItem.Content,
                            Tooltip     = menuItem.ToolTip,
                            Label       = menuItem.Text,
                            Key         = menuItem.GetHashCode()
                        };

                        Feeds.Add(newFeed);
                    }
                }
                else
                {
                    menuItem = (HamburgerMenuItem)ItemContainerGenerator.ContainerFromItem(item);
                }

                menuItem.BarBrush = BarBrush;
                itemController.AddItem(menuItem);
            }
        }
Пример #3
0
 private void OnSelectedItemChanged(HamburgerMenuItem item)
 {
     SetCurrentValue(SelectedItemProperty, item);
 }