void operationControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Будем разрешать выбирать только операции
            FilterOperationItemControl operation = operationControl.SelectedItem as FilterOperationItemControl;

            if (operation != null)
            {
                m_SelectedOperationIndex = operationControl.SelectedIndex;
            }

            //ItemsSplitter splitter = operationControl.SelectedItem as ItemsSplitter;
            //if (splitter != null)
            //{
            //    if (e.RemovedItems != null && e.RemovedItems.Count > 0)
            //    {
            //        //splitter.UpdateLayout();
            //        //operationControl.SelectedIndex = operationControl.Items.IndexOf(e.RemovedItems[0]);
            //        //operationControl.SelectedItem = e.RemovedItems[0];
            //    }
            //    else
            //        operationControl.SelectedIndex = 0;
            //    return;
            //}

            CustomItemControl custom = operationControl.SelectedItem as CustomItemControl;

            if (custom != null)
            {
                //if (e.RemovedItems != null && e.RemovedItems.Count > 0)
                //{
                //    //custom.UpdateLayout();
                //    //operationControl.SelectedIndex = operationControl.Items.IndexOf(e.RemovedItems[0]);
                //    //operationControl.SelectedItem = e.RemovedItems[0];
                //}
                //else
                //    operationControl.SelectedIndex = 0;

                EventHandler <CustomItemEventArgs> handler = this.CustomCommandClick;
                if (handler != null)
                {
                    handler(this, new CustomItemEventArgs(custom.Type));
                }
                return;
            }
            //operationControl.UpdateLayout();
        }
        private void InitItems()
        {
            operationControl.SelectionChanged -= new SelectionChangedEventHandler(operationControl_SelectionChanged);
            operationControl.Items.Clear();

            FilterOperationItemControl item = new FilterOperationItemControl(OperationTypes.And);

            operationControl.Items.Add(item);
            item = new FilterOperationItemControl(OperationTypes.Or);
            operationControl.Items.Add(item);

            ItemsSplitter splitter = new ItemsSplitter();

            splitter.IsTabStop = false;
            splitter.Width     = 150;
            operationControl.Items.Add(splitter);

            CustomItemControl custom = new CustomItemControl(CustomControlTypes.AddOperation);

            operationControl.Items.Add(custom);

            custom = new CustomItemControl(CustomControlTypes.AddOperand);
            operationControl.Items.Add(custom);

            splitter           = new ItemsSplitter();
            splitter.IsTabStop = false;
            splitter.Width     = 150;
            operationControl.Items.Add(splitter);

            if (m_IsRoot)
            {
                custom = new CustomItemControl(CustomControlTypes.Clear);
                operationControl.Items.Add(custom);
            }
            else
            {
                custom = new CustomItemControl(CustomControlTypes.Delete);
                operationControl.Items.Add(custom);
            }
            operationControl.SelectionChanged += new SelectionChangedEventHandler(operationControl_SelectionChanged);
        }
        private void InitItems()
        {
            operationControl.SelectionChanged -= new SelectionChangedEventHandler(operationControl_SelectionChanged);
            operationControl.Items.Clear();

            FilterOperationItemControl item = new FilterOperationItemControl(OperationTypes.And);
            operationControl.Items.Add(item);
            item = new FilterOperationItemControl(OperationTypes.Or);
            operationControl.Items.Add(item);

            ItemsSplitter splitter = new ItemsSplitter();
            splitter.IsTabStop = false;
            splitter.Width = 150;
            operationControl.Items.Add(splitter);

            CustomItemControl custom = new CustomItemControl(CustomControlTypes.AddOperation);
            operationControl.Items.Add(custom);

            custom = new CustomItemControl(CustomControlTypes.AddOperand);
            operationControl.Items.Add(custom);

            splitter = new ItemsSplitter();
            splitter.IsTabStop = false;
            splitter.Width = 150;
            operationControl.Items.Add(splitter);

            if (m_IsRoot)
            {
                custom = new CustomItemControl(CustomControlTypes.Clear);
                operationControl.Items.Add(custom);
            }
            else
            {
                custom = new CustomItemControl(CustomControlTypes.Delete);
                operationControl.Items.Add(custom);
            }
            operationControl.SelectionChanged += new SelectionChangedEventHandler(operationControl_SelectionChanged);
        }