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


    CustomPropertyItem Class
    Used when properties are provided using a list source of items (e.g., Properties or PropertiesSource).
    Syntax
    'Declaration
     
    <TemplatePartAttribute(Name="PART_PropertyItemsControl", Type=Xceed.Wpf.Toolkit.PropertyGrid.PropertyItemsControl)>
    <StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)>
    <XmlLangPropertyAttribute("Language")>
    <UsableDuringInitializationAttribute(True)>
    <RuntimeNamePropertyAttribute("Name")>
    <UidPropertyAttribute("Uid")>
    <TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
    <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
    Public Class CustomPropertyItem 
       Inherits PropertyItemBase
     
    'Usage
     
    Dim instance As CustomPropertyItem
    Remarks
    An instance of this class can be used as an item to easily customize the display of the property directly by modifying the values of this class (e.g., DisplayName, value, Category, etc.).
    Example
    <!-- 
    No assignement of any of PropertyNameBinding or PropertyValueBinding. CustomProperties
    will each have all the values directly set.
    -->
    <xctk:PropertyGrid x:Name="_propertyGrid" Grid.Row="1" Width="350" >
       <xctk:PropertyGrid.EditorDefinitions>
          <xctk:EditorTextDefinition TargetProperties="firstName,lastName" 
                                     FontWeight="Bold" 
                                     FontStyle="Italic"/>
       </xctk:PropertyGrid.EditorDefinitions>
       <xctk:PropertyGrid.Properties>
          <!--Use CustomPropertyItem and control each aspect of them-->
          <!--Here we Specify a DefinitionKey to assign a specific CUSTOM editor-->
          <xctk:CustomPropertyItem DisplayName="First Name" Value="Nancy" Category="Name"
                                   DefinitionKey="firstName" />
          <xctk:CustomPropertyItem DisplayName="Last Name" Value="Davolio" Category="Name"
                                   DefinitionKey="lastName"/>
    
          <!-- Here we specify a DefinitionKey to assign a specific DEFAULT editor.-->
          <!--  Since the XAML parser will parse "29" as a string, the TypeConverter defined
          on Int32 struct will automatically make the conversion. -->
          <xctk:CustomPropertyItem DisplayName="Age" Value="29" Category="Other"
                                   DefinitionKey="{x:Type s:Int32}" />
          
          <!-- For thoses values where no TypeConverter supporting strings are defined, you must
          use the Proeprty Element syntax to define the value -->
          <xctk:CustomPropertyItem DisplayName="Coordinates" Category="Other" 
                                   Description="Location on the state map">
             <xctk:CustomPropertyItem.Value>
                <v:Coords X="12" Y="15"/>
             </xctk:CustomPropertyItem.Value>
          </xctk:CustomPropertyItem>
    
          <!--Here we define a specific editor directly. No value -->
          <xctk:CustomPropertyItem DisplayName="Picture" Category="Other">
             <xctk:CustomPropertyItem.Editor>
                <Image Source="/Samples/PropertyGrid/Resources/woman.png" 
                       Stretch="None"
                       HorizontalAlignment="Left"/>
             </xctk:CustomPropertyItem.Editor>
          </xctk:CustomPropertyItem>
          
       </xctk:PropertyGrid.Properties>
       
       <!-- You must specify that the grouping is based on the value of "Category" Property -->
       <xctk:PropertyGrid.CategoryGroupDescription>
          <PropertyGroupDescription PropertyName="Category"/>
       </xctk:PropertyGrid.CategoryGroupDescription>
    </xctk:PropertyGrid>
    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         Xceed.Wpf.Toolkit.PropertyGrid.PropertyItemBase
                            Xceed.Wpf.Toolkit.PropertyGrid.CustomPropertyItem
                               Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem

    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