public override object EditValue(
     ITypeDescriptorContext context,
     System.IServiceProvider provider,
     object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService service1 = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         ITypeDiscoveryService      service2 = (ITypeDiscoveryService)provider.GetService(typeof(ITypeDiscoveryService));
         IDesignerHost           service3    = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
         IComponentChangeService service4    = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService));
         ISelectionService       service5    = (ISelectionService)provider.GetService(typeof(ISelectionService));
         if (service1 == null)
         {
             return(value);
         }
         RadItemOwnerCollection collection = value as RadItemOwnerCollection;
         RadGalleryGroupItem    instance   = context.Instance as RadGalleryGroupItem;
         if (collection == null || instance == null)
         {
             return(value);
         }
         if (instance.Owner == null && service5 != null && (service5.PrimarySelection != null && service5.PrimarySelection is RadGalleryElement))
         {
             instance.Owner = (RadGalleryElement)service5.PrimarySelection;
         }
         RadGalleryElement owner = instance.Owner;
         if (owner == null)
         {
             return(value);
         }
         if (this.groupedItemsUI == null)
         {
             this.groupedItemsUI = new GroupedItemsEditorUI();
         }
         service4.OnComponentChanging(context.Instance, (MemberDescriptor)TypeDescriptor.GetProperties(context.Instance)["Items"]);
         this.groupedItemsUI.Start(service1, service2, service3, collection, instance, owner);
         if (service1.ShowDialog((Form)this.groupedItemsUI) == DialogResult.OK)
         {
             this.groupedItemsUI.End();
             value = (object)this.groupedItemsUI.Value;
             service4.OnComponentChanged(context.Instance, (MemberDescriptor)TypeDescriptor.GetProperties(context.Instance)["Items"], (object)null, (object)null);
             return(value);
         }
     }
     return(value);
 }
Example #2
0
        private void PopulateAvailableItems()
        {
            ArrayList list1 = new ArrayList();

            if (this.FilterTypeBox.SelectedIndex == 0)
            {
                //load all items
                foreach (RadGalleryItem item1 in defaultElement.Items)
                {
                    if (!(bool)item1.GetValue(RadItem.IsAddNewItemProperty))
                    {
                        list1.Add(item1);
                    }
                }
                foreach (RadGalleryGroupItem group1 in defaultElement.Groups)
                {
                    GroupedItemsEditorUI.RemoveItemsContainedInGroup(list1, group1.Items);
                }
                for (int i = 0; i < list1.Count; i++)
                {
                    list1[i] = new InstanceItem((list1[i] as RadGalleryItem), defaultElement);
                }
            }
            else if (this.FilterTypeBox.SelectedIndex == 1)
            {
                foreach (RadGalleryGroupItem group1 in defaultElement.Groups)
                {
                    if (group1 != defaultGroup)
                    {
                        //load all items
                        foreach (RadGalleryItem item1 in group1.Items)
                        {
                            list1.Add(new InstanceItem(item1, defaultElement));
                        }
                    }
                }
            }

            // set the items box
            this.AvailableItemsBox.BeginUpdate();
            this.AvailableItemsBox.Items.Clear();
            this.AvailableItemsBox.Items.AddRange(list1.ToArray());
            this.AvailableItemsBox.EndUpdate();
            this.SetButtonsEnabledState();
        }
Example #3
0
        private void PopulateAvailableItems()
        {
            ArrayList items = new ArrayList();

            if (this.FilterTypeBox.SelectedIndex == 0)
            {
                foreach (RadGalleryItem radGalleryItem in (RadItemCollection)this.defaultElement.Items)
                {
                    if (!(bool)radGalleryItem.GetValue(RadItem.IsAddNewItemProperty))
                    {
                        items.Add((object)radGalleryItem);
                    }
                }
                foreach (RadGalleryGroupItem group in (RadItemCollection)this.defaultElement.Groups)
                {
                    GroupedItemsEditorUI.RemoveItemsContainedInGroup(items, group.Items);
                }
                for (int index = 0; index < items.Count; ++index)
                {
                    items[index] = (object)new GroupedItemsEditorUI.InstanceItem(items[index] as RadGalleryItem, this.defaultElement);
                }
            }
            else if (this.FilterTypeBox.SelectedIndex == 1)
            {
                foreach (RadGalleryGroupItem group in (RadItemCollection)this.defaultElement.Groups)
                {
                    if (group != this.defaultGroup)
                    {
                        foreach (RadGalleryItem instance in (RadItemCollection)group.Items)
                        {
                            items.Add((object)new GroupedItemsEditorUI.InstanceItem(instance, this.defaultElement));
                        }
                    }
                }
            }
            this.AvailableItemsBox.BeginUpdate();
            this.AvailableItemsBox.Items.Clear();
            this.AvailableItemsBox.Items.AddRange(items.ToArray());
            this.AvailableItemsBox.EndUpdate();
            this.SetButtonsEnabledState();
        }