Search code examples
wpfvb.netpropertygrid

WPF Property grid using PropertyInspectorView


I am using PropertyInspectorView in WorkflowDesigner as a property grid in my WPF application.

http://img89.imageshack.us/img89/2176/propertygrid.jpg

Here I want to,

  1. Remove the "Clear" button

  2. Change the Icons/background color of "Categorize" and "Sort A-Z" buttons.

  3. Move these two buttons to the right side of the search text box.

  4. Change the colors (Background, Font, Border)

Please let me know if these things possible? Then how?


Solution

  • To change the colors use the following keys,

    PropertyInspectorBackgroundBrushKey

    PropertyInspectorBorderBrushKey

    PropertyInspectorCategoryCaptionTextBrushKey

    PropertyInspectorPaneBrushKey

    PropertyInspectorToolBarBackgroundBrushKey

    PropertyInspectorSelectedBackgroundBrushKey

    PropertyInspectorSelectedForegroundBrushKey

        Dim Designer As New WorkflowDesigner()
        Dim rd As String = "<ResourceDictionary
                                x:Uid='ResourceDictionary_1' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
                                xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
                                xmlns:sap='clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation'
                                xmlns:sapv ='clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation'> 
                                <SolidColorBrush x:Uid='SolidColorBrush_01' x:Key='{x:Static sap: WorkflowDesignerColors.PropertyInspectorBackgroundBrushKey}' Color='Red'/>
                                </ResourceDictionary>"
    
    
        Dim reader As New StringReader(rd)
        Dim xmlReader As XmlReader = XmlReader.Create(reader)
        Dim fontAndColorDictionary As ResourceDictionary = DirectCast(System.Windows.Markup.XamlReader.Load(xmlReader), ResourceDictionary)
        Dim hashTable As New Hashtable()
        For Each key As String In fontAndColorDictionary.Keys
            hashTable.Add(key, fontAndColorDictionary(key))
        Next
    
        Designer.PropertyInspectorFontAndColorData = XamlServices.Save(hashTable)