Xceed Toolkit Plus for WPF v4.6 Documentation
IItemsSource Interface
Members  Example 


Xceed.Wpf.Toolkit Assembly > Xceed.Wpf.Toolkit.PropertyGrid.Attributes Namespace : IItemsSource Interface

Provides an interface that is implemented by classes when a scenario calls for use of a collection of values represented by a ComboBox for a given property.

Syntax
'Declaration
 
Public Interface IItemsSource 
'Usage
 
Dim instance As IItemsSource
public interface IItemsSource 
Remarks

You must decorate your property with ItemsSourceAttribute.

Example
First, create a class that implements IItemsSource.
public class FontSizeItemsSource : IItemsSource
{
    public ItemCollection GetValues()
    {
        ItemCollection sizes = new ItemCollection();
        sizes.Add(5.0, "Five");
        sizes.Add(5.5);
        sizes.Add(6.0, "Six");
        sizes.Add(6.5);
        sizes.Add(7.0, "Seven");
        sizes.Add(7.5);
        sizes.Add(8.0, "Eight");
        sizes.Add(8.5);
        sizes.Add(9.0, "Nine");
        sizes.Add(9.5);
        sizes.Add(10.0);
        sizes.Add(12.0, "Twelve");
        sizes.Add(14.0);
        sizes.Add(16.0);
        sizes.Add(18.0);
        sizes.Add(20.0);
        return sizes;
    }
}
Then decorate the property with the ItemsSource attribute.
public class Person
{
    [Category("Writing")]
    [DisplayName("Writing Font Size")]
    [Description("This property uses the DoubleUpDown as the default editor.")]
    [ItemsSource(typeof(FontSizeItemsSource))]
    public double WritingFontSize { get; set; }
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IItemsSource Members
Xceed.Wpf.Toolkit.PropertyGrid.Attributes Namespace