Exemplo n.º 1
0
        private void OnCategoryCollectionChanged(Object sender, CollectionChangeEventArgs e)
        {
            ToolBoxCategory tbc = e.Element as ToolBoxCategory;

            if (e.Action == CollectionChangeAction.Add)
            {
                tbc.Items.ItemChanged += new CollectionChangeEventHandler(OnCategoryItemChanged);
            }
            else if (e.Action == CollectionChangeAction.Remove)
            {
                tbc.Items.ItemChanged -= new CollectionChangeEventHandler(OnCategoryItemChanged);
            }
            Invalidate();
        }
Exemplo n.º 2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            ToolBoxItem item = GetToolboxItemByPoint(e.Location);

            if (item != null)
            {
                if (item is ToolBoxCategory)
                {
                    ToolBoxCategory tbc = item as ToolBoxCategory;
                    tbc.IsOpen = !tbc.IsOpen;
                    RefreshScrollBar();
                    Invalidate();
                }
                else
                {
                    _selectedItem = item;
                    _selectedItem.OnClickEvent();
                    Invalidate();
                }
            }
        }