Ejemplo n.º 1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            // Mouse was clicked
            if (mouseIsDown)
            {
                string prevSelectedCategoryItemDescription = lastSelectedCategoryItemDescription;
                string selectedCategoryDescription = "";
                string selectedCategoryKey = "";

                bool someCategoryExpanedCollapsed = false;

                // First check if we are expanding/collapsing any categories
                foreach (Category category in categories.Values)
                {
                    bool prevCategoryCollapsed = category.Collapsed;
                    category.HeaderHitTest(e.Location);

                    if (!someCategoryExpanedCollapsed)
                    {
                        someCategoryExpanedCollapsed = prevCategoryCollapsed != category.Collapsed;
                    }
                }

                // hit test for each category item
                if (!someCategoryExpanedCollapsed)
                {
                    foreach (Category category in categories.Values)
                    {
                        category.ClearSelection();
                        category.ItemHitTest(e.Location);

                        if (category.HasSelectedCategoryItem)
                        {
                            lastSelectedCategoryItemDescription = category.SelectedCategoryItemDescription;
                            selectedCategoryDescription = category.Text;
                            selectedCategoryKey = category.Key;
                        }
                    }
                }

                CheckForRedraw();

                if (prevSelectedCategoryItemDescription != lastSelectedCategoryItemDescription)
                {
                    SelectionChangedEventArgs args = new SelectionChangedEventArgs();
                    args.CategoryDescription = selectedCategoryDescription;
                    args.CategoryKey = selectedCategoryKey;

                    OnSelectionChanged(args);
                }
            }

            mouseIsDown = false;

            base.OnMouseUp(e);
        }
Ejemplo n.º 2
0
        protected virtual void OnSelectionChanged(SelectionChangedEventArgs args)
        {
            SelectionChangedDelegate handler = SelectionChanged;

            if (handler != null)
            {
                handler(this, args);
            }
        }
Ejemplo n.º 3
0
 private void categoryControl1_SelectionChanged(object sender, SelectionChangedEventArgs args)
 {
     //MessageBox.Show(args.CategoryKey + " " + args.CategoryDescription + " " + args.CategoryItemDescriptoin);
 }