示例#1
0
        public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
            I_ControlHelper MyControlHelper = null;

            if (HasRangeOfValues)
            {
                MyControlHelper = ControlHelper.KeyValueControlHelper(Column);
            }
            else
            {
                MyControlHelper = ControlHelper.GetControlHelper(Column, ColumnSetting, null);
            }
            MyControlHelper.SetReadonly(IsReadOnly);
            if (MyControlHelper is I_ControlHelperValueRange)
            {
                if (ColumnValueRange != null)
                {
                    (MyControlHelper as I_ControlHelperValueRange).SetColumnValueRange(ColumnValueRange);
                }
            }
            cell.Tag = MyControlHelper;
            if (ButtonMenus.Any())
            {
                foreach (var item in ButtonMenus)
                {
                    var newMenu = new ConrolPackageMenu();
                    newMenu.Name         = item.Name;
                    newMenu.Title        = item.Title;
                    newMenu.MenuClicked += (sender, e) => Item_MenuClicked(sender, e, item, dataItem);
                    MyControlHelper.AddButtonMenu(newMenu);
                }
            }
            return(MyControlHelper.WholeControl);
        }
示例#2
0
 private void MenuItem_Click(object sender, RadRoutedEventArgs e, ConrolPackageMenu cpMenu, Tuple <object, string> cellItem)
 {
     if (cpMenu != null)
     {
         ConrolPackageMenuArg arg = new ConrolPackageMenuArg();
         arg.data = cellItem;
         cpMenu.OnMenuClicked(sender, arg);
     }
 }
示例#3
0
        //private List<FormulaItemDTO> GetFlatList(List<FormulaItemDTO> treeFormulaItems, List<FormulaItemDTO> result = null)
        //{
        //    if (result == null)
        //        result = new List<FormulaItemDTO>();
        //    foreach (var item in treeFormulaItems)
        //    {
        //        if (item.ItemType == FormuaItemType.Column)
        //            result.Add(item);
        //        GetFlatList(item.ChildFormulaItems, result);
        //    }
        //    return result;
        //}

        private void AddMenu()
        {
            foreach (var columnControl in FormulaColumns)
            {
                var cpMenuFormulaCalculation = new ConrolPackageMenu();
                cpMenuFormulaCalculation.Name    = "mnuFormulaCalculation";
                cpMenuFormulaCalculation.Title   = "محاسبه فرمول";
                cpMenuFormulaCalculation.Tooltip = columnControl.Column.ColumnCustomFormula.Formula.Tooltip;
                columnControl.SimpleControlManager.AddButtonMenu(cpMenuFormulaCalculation);
                cpMenuFormulaCalculation.MenuClicked += (sender1, e1) => CpMenuFormulaCalculation_MenuClicked(sender1, e1, columnControl as SimpleColumnControl);
            }
        }
示例#4
0
 internal void AddButtonMenu(ConrolPackageMenu menu, object dataItem)
 {
     System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() =>
     {
         var dataRow = this.DataControl.GetRowForItem(dataItem);
         var cell    = dataRow.GetCell(this);
         if (cell != null)
         {
             if (cell.Content != null)
             {
                 (cell.Tag as I_ControlHelper).AddButtonMenu(menu);
             }
         }
     }));
 }
        internal void GenerateMenu(FrameworkElement element, ConrolPackageMenu cpMenu)
        {
            RadContextMenu contextMenu = RadContextMenu.GetContextMenu(element);

            if (contextMenu == null)
            {
                contextMenu = new RadContextMenu();
                RadContextMenu.SetContextMenu(element, contextMenu);
            }

            var menuItem = new RadMenuItem();

            menuItem.Name   = cpMenu.Name;
            menuItem.Header = cpMenu.Title;
            menuItem.Click += (sender, e) => MenuItem_Click(sender, e, cpMenu);
            contextMenu.Items.Add(menuItem);
        }
        public void AddButtonMenu(ConrolPackageMenu menu)
        {
            if (dropDownButton == null)
            {
                dropDownButton        = new RadDropDownButton();
                dropDownButton.Height = 22;
                dropDownButton.Width  = 60;
                //dropDownButton.HorizontalAlignment = HorizontalAlignment.Left;
                dropDownButton.Margin = new System.Windows.Thickness(2);
                listBox = new ListBox();
                dropDownButton.DropDownContent = listBox;
                dropDownButton.Content         = "منو";
                var listitem = new ListBoxItem();
                dropDownButton.HorizontalAlignment = HorizontalAlignment.Right;

                theGrid.ColumnDefinitions.Add(new ColumnDefinition());
                Grid.SetColumn(dropDownButton, theGrid.ColumnDefinitions.Count);
                theGrid.Children.Add(dropDownButton);
            }

            var menuButton = new Button();

            menuButton.Name    = menu.Name;
            menuButton.Content = menu.Title;
            if (!string.IsNullOrEmpty(menu.Tooltip))
            {
                ToolTipService.SetToolTip(menuButton, menu.Tooltip);
            }
            menuButton.Click += (sender, e) => MenuButton_Click(sender, e, menu);
            listBox.Items.Add(menuButton);
            //(item as CommandManager).Button.HorizontalContentAlignment = HorizontalAlignment.Left;


            //theGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
            //var menuButton = new Button();
            //menuButton.Name = menu.Name;
            //menuButton.Content = menu.Title;
            //menuButton.Click += (sender, e) => MenuButton_Click(sender, e, menu);
            //Grid.SetColumn(menuButton, theGrid.ColumnDefinitions.Count);
            //theGrid.Children.Add(menuButton);
        }
示例#7
0
 internal void GenerateMenu(ConrolPackageMenu cpMenu)
 {
     CPMenu = cpMenu;
 }
示例#8
0
 internal void AddButtonMenu(ConrolPackageMenu menu)
 {
     ButtonMenus.Add(menu);
 }
示例#9
0
 private void Item_MenuClicked(object sender, ConrolPackageMenuArg e, ConrolPackageMenu mainMenu, object dataItem)
 {
     e.data = dataItem;
     mainMenu.OnMenuClicked(sender, e);
 }
 private void MenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e, ConrolPackageMenu cpMenu)
 {
     if (cpMenu != null)
     {
         ConrolPackageMenuArg arg = new ConrolPackageMenuArg();
         cpMenu.OnMenuClicked(sender, arg);
     }
 }
示例#11
0
 public void AddButtonMenu(object dataItem, ConrolPackageMenu menu)
 {
     DataGridColumn.AddButtonMenu(menu, dataItem);
 }
示例#12
0
 public void AddButtonMenu(ConrolPackageMenu menu)
 {
     DataGridColumn.AddButtonMenu(menu);
 }
 public void AddButtonMenu(object dataItem, ConrolPackageMenu menu)
 {
     MyControlHelper.AddButtonMenu(menu);
 }
 public void AddButtonMenu(ConrolPackageMenu menu)
 {
     MyControlHelper.AddButtonMenu(menu);
 }
        //public void ClearAllValidations()
        //{
        //    ValidationItems.Clear();
        //    SetTooltip();
        //    SetColor();
        //}


        //public void AddMessage(BaseMessageItem item)
        //{
        //    MessageItems.Add(item);
        //    SetTooltip();
        //    SetColor();
        //}
        //public void RemoveMessage(BaseMessageItem baseMessageItemem)
        //{
        //    foreach (var item in MessageItems.Where(x => x.CausingDataItem == baseMessageItemem.CausingDataItem && x.Key == baseMessageItemem.Key).ToList())
        //        MessageItems.Remove(item);
        //    SetTooltip();
        //    SetColor();
        //}
        //public void RemoveMessageByKey(string key)
        //{
        //    foreach (var item in MessageItems.Where(x => x.Key == key).ToList())
        //        MessageItems.Remove(item);
        //    SetTooltip();
        //    SetColor();
        //}

        //private void SetColor()
        //{
        //    var color = InfoColor.Default;
        //    if (MessageItems.Any(x => x.Color != InfoColor.Default))
        //        color = MessageItems.First(x => x.Color != InfoColor.Default).Color;
        //    if (color != InfoColor.Default)
        //        MyControlHelper.SetColor( color);
        //    else
        //        MyControlHelper.ClearColor();
        //}

        //private void SetTooltip()
        //{
        //    var tooltip = "";
        //    foreach (var item in MessageItems)
        //        tooltip += (tooltip == "" ? "" : Environment.NewLine) + item.Message;
        //    if (tooltip != "")
        //        MyControlHelper.SetTooltip( tooltip);
        //    else
        //        MyControlHelper.ClearTooltip();
        //}


        public void AddMenu(ConrolPackageMenu menu)
        {
            MenuHelper.GenerateMenu(MyControlHelper.MainControl, menu);
        }
        private void MenuButton_Click(object sender, RoutedEventArgs e, ConrolPackageMenu menu)
        {
            ConrolPackageMenuArg arg = new ConrolPackageMenuArg();

            menu.OnMenuClicked(sender, arg);
        }