Esempio n. 1
0
 public void AddCommand(I_CommandManager item, bool indirect)
 {
     //Button btnCommand = UIHelper.GenerateCommand(item);
     //item.EnabledChanged += (sender, e) => item_EnabledChanged(sender, e, btnCommand);
     //btnCommand.Click += btnCommand_Click;
     toolbar.Items.Add((item as MyUIGenerator.UIControlHelper.CommandManager).Button);
 }
Esempio n. 2
0
        public void AddCommand(I_CommandManager item, bool indirect)
        {
            if (grdMain == null)
            {
                grdMain  = new Grid();
                grdOther = new Grid();
                Toolbar.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                Toolbar.ColumnDefinitions.Add(new ColumnDefinition());
                Toolbar.Children.Add(grdMain);
                Toolbar.Children.Add(grdOther);
                Grid.SetColumn(grdOther, 1);
            }
            //Button btnCommand = UIHelper.GenerateCommand(item);
            ////item.EnabledChanged += (sender, e) => item_EnabledChanged(sender, e, btnCommand);
            //btnCommand.Click += btnCommand_Click;
            //if (Toolbar.ColumnDefinitions.Count == 0)
            //    Toolbar.ColumnDefinitions.Add(new ColumnDefinition());

            if (indirect == false)
            {
                grdMain.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                grdMain.Children.Add((item as CommandManager).Button);
                Grid.SetColumn((item as CommandManager).Button, grdMain.ColumnDefinitions.Count - 1);
            }
            else
            {
                if (dropDownButton == null)
                {
                    dropDownButton        = new RadDropDownButton();
                    dropDownButton.Height = 22;
                    dropDownButton.Width  = 35;
                    //dropDownButton.HorizontalAlignment = HorizontalAlignment.Left;
                    dropDownButton.Margin = new System.Windows.Thickness(2);
                    listBox = new ListBox();
                    dropDownButton.DropDownContent = listBox;
                    Image img = new Image();
                    img.Width = 15;
                    Uri uriSource = new Uri("../../Images/report.png", UriKind.Relative);
                    img.Source             = new BitmapImage(uriSource);
                    dropDownButton.Content = img;
                    var listitem = new ListBoxItem();
                    dropDownButton.HorizontalAlignment = HorizontalAlignment.Right;
                    grdOther.Children.Add(dropDownButton);
                }
                //(item as CommandManager).Button.HorizontalContentAlignment = HorizontalAlignment.Left;
                listBox.Items.Add((item as CommandManager).Button);
            }
            if (dropDownButton != null)
            {
                //Toolbar.Items.Remove(dropDownButton);
            }
        }