Example #1
0
        public FrmAdministracija()
        {
            InitializeComponent();
            CMenuItemDef lmeniDef = new CMenuItemDef();

            lmeniDef.LoadMenu("GL");
            this.CreateMenu(lmeniDef);
        }
Example #2
0
        private void CreateMenu(CMenuItemDef pmniDef)
        {
            Menu mojMeni = new Menu();

            mojMeni.VerticalAlignment   = VerticalAlignment.Top;
            mojMeni.HorizontalAlignment = HorizontalAlignment.Stretch;
            mojMeni.Height = 25;
            mainGrid.Children.Add(mojMeni);

            foreach (CMenuItemDef miTempDef in pmniDef.Items)
            {
                MenuItem mniItem = new MenuItem();
                mniItem.Header    = miTempDef.Header;
                mniItem.IsEnabled = miTempDef.IsEnabled;
                string test = miTempDef.PutanjaDoIkonice.ToString();


                mniItem.Icon = new Image
                {
                    Source = new BitmapImage(new Uri(test, UriKind.Relative))
                };

                mniItem.Resources.Add("APP_OPTION", miTempDef.OptionId);


                if (miTempDef.Items.Count == 0 || miTempDef.OptionId != "")
                {
                    mniItem.Click += MenuClick;
                }
                else
                {
                    this.CreateSubMenu(mniItem, miTempDef.Items);
                }

                mojMeni.Items.Add(mniItem);
            }
        }