void ExpandMenuCanva_Loaded(object sender, RoutedEventArgs e)
 {
     if (this.TaskMenus == null || this.TaskMenus.Children.Count > 0) return;
     ObservableCollection<TaskMenuItemEntity> taskMenuItems = this.ItemsSource as ObservableCollection<TaskMenuItemEntity>;
     if (taskMenuItems == null) return;
     foreach (TaskMenuItemEntity menuItem in taskMenuItems)
     {
         TaskMenuControl item = new TaskMenuControl();
         int childCount = menuItem.TaskMenuEventItems.Count;
         //item.Height = 25 * childCount + 100;
         item.Margin = new Thickness(-1);
         item.ItemClicked += new RoutedEventHandler(this.TaskItemEvent);
         item.SetBinding(menuItem);
         this.TaskMenus.Children.Add(item);
     }
 }
        protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            base.OnItemsChanged(e);

            if (this.TaskMenus == null) return;
            this.TaskMenus.Children.Clear();
            ObservableCollection<TaskMenuItemEntity> taskMenuItems = this.ItemsSource as ObservableCollection<TaskMenuItemEntity>;
            if (taskMenuItems == null) return;
            foreach (TaskMenuItemEntity menuItem in taskMenuItems)
            {
                TaskMenuControl item = new TaskMenuControl();
                int childCount = menuItem.TaskMenuEventItems.Count;
                //item.Height = 25 * childCount + 100;
                item.Margin = new Thickness(-1);
                item.SetBinding(menuItem);
                this.TaskMenus.Children.Add(item);
            }
        }