~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/WixBinding/Project/Src/PropertyGrid/WixDropDownEditor.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
using System.ComponentModel;
 
7
using System.Drawing.Design;
 
8
using System.Windows.Forms;
 
9
using System.Windows.Forms.Design;
 
10
using ICSharpCode.SharpDevelop.Widgets.DesignTimeSupport;
 
11
 
 
12
namespace ICSharpCode.WixBinding
 
13
{
 
14
        public class WixDropDownEditor : DropDownEditor
 
15
        {
 
16
                protected override Control CreateDropDownControl(ITypeDescriptorContext context, IWindowsFormsEditorService editorService)
 
17
                {
 
18
                        return new DropDownEditorListBox(editorService, GetDropDownItems(context));
 
19
                }
 
20
                
 
21
                IEnumerable<string> GetDropDownItems(ITypeDescriptorContext context)
 
22
                {
 
23
                        if (context != null) {
 
24
                                WixXmlAttributePropertyDescriptor propertyDescriptor = context.PropertyDescriptor as WixXmlAttributePropertyDescriptor;
 
25
                                if (propertyDescriptor != null && propertyDescriptor.WixXmlAttribute.HasValues) {
 
26
                                        return propertyDescriptor.WixXmlAttribute.Values;
 
27
                                }
 
28
                        }
 
29
                        return new string[0];
 
30
                }
 
31
        }
 
32
}