Xceed Toolkit Plus for WPF v5.0 Documentation
Xceed.Wpf.Toolkit Assembly / Xceed.Wpf.Toolkit.PropertyGrid.Attributes Namespace / DependsOnAttribute Class
Members


In This Topic
    DependsOnAttribute Class
    In This Topic
    Takes a list of strings in parameter that represent the names of properties that affect the current property. It is placed over any properties of the PropertyGrid's selectedObject.
    Syntax
    'Declaration
     
    <AttributeUsageAttribute(AttributeTargets.Property, 
       AllowMultiple=True, 
       Inherited=True)>
    Public Class DependsOnAttribute 
       Inherits System.Attribute
    'Usage
     
    Dim instance As DependsOnAttribute
    [AttributeUsage(AttributeTargets.Property, 
       AllowMultiple=true, 
       Inherited=true)]
    public class DependsOnAttribute : System.Attribute 
    Example

    [Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
    [DependsOn( "IsMale", "LastName" )]
    public string FirstName { get; set; }


    Here, the property "FirstName" has its own editor. If the properties "IsMale" or "LastName" are modified, the editor of property "FirstName" will be re-evaluated. This allows a user to modify the editor to change its background, ItemsSources, or create a new editor.

    It is also possible to have different properties with the same "DependsOn".

    [Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
    [DependsOn( "IsMale" )]
    public string FirstName { get; set; }

    [Editor( typeof( LastNameEditor ), typeof( LastNameEditor ) )]
    [DependsOn( "IsMale" )]
    public string LasttName { get; set; }

    Here, the editors of properties "FirstName" and "LastName" will be re-evaluated if the property "IsMale" is changed.

    Inheritance Hierarchy

    System.Object
       System.Attribute
          Xceed.Wpf.Toolkit.PropertyGrid.Attributes.DependsOnAttribute

    Requirements

    See Also