Question

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?

Was it helpful?

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)

OTHER TIPS

In addition to @Sugath's answer, there are more keys to set. Please refer to https://docs.microsoft.com/en-us/dotnet/api/system.activities.presentation.workflowdesignercolors?view=netframework-4.8 for more information.

In addition, there is an easier way to create the hashtable:

Hashtable hashTable = new Hashtable
{
    { WorkflowDesignerColors.PropertyInspectorBackgroundBrushKey, backgroundLightBrush },
    { WorkflowDesignerColors.PropertyInspectorTextBrushKey, textBrush },
    { WorkflowDesignerColors.PropertyInspectorCategoryCaptionTextBrushKey, textBrush },
    { WorkflowDesignerColors.PropertyInspectorPaneBrushKey, backgroundDarkBrush },
    { WorkflowDesignerColors.PropertyInspectorToolBarBackgroundBrushKey, backgroundDarkBrush },
    { WorkflowDesignerColors.PropertyInspectorSelectedBackgroundBrushKey, backgroundLightBrush },
    { WorkflowDesignerColors.PropertyInspectorSelectedForegroundBrushKey, textBrush },
};

_Designer.PropertyInspectorFontAndColorData = System.Xaml.XamlServices.Save(hashTable);

Other keys:

PropertyInspectorBackgroundBrushKey Gets the brush key for the property inspector background.

PropertyInspectorBorderBrushKey Gets the brush key for the property inspector border.

PropertyInspectorCategoryCaptionTextBrushKey
Gets the brush key for the category caption text in the property inspector.

PropertyInspectorPaneBrushKey
Gets the brush key for the property inspector pane.

PropertyInspectorPopupBrushKey
Gets the brush key for the property inspector pop-up window.

PropertyInspectorSelectedBackgroundBrushKey Gets the brush key for the selected background in the property inspector.

PropertyInspectorSelectedForegroundBrushKey Gets the brush key for the selected foreground in the property inspector.

PropertyInspectorTextBrushKey
Gets the brush key for the property inspector text.

PropertyInspectorToolBarBackgroundBrushKey
Gets the brush key for the toolbar background in the property inspector.

PropertyInspectorToolBarItemHoverBackgroundBrushKey Gets the brush key for the background of a hovered item in the property inspector toolbar.

PropertyInspectorToolBarItemHoverBorderBrushKey Gets the brush key for the border of a hovered item in the property inspector toolbar.

PropertyInspectorToolBarItemSelectedBackgroundBrushKey
Gets the brush key for the background of a selected item in the property inspector toolbar.

PropertyInspectorToolBarItemSelectedBorderBrushKey
Gets the brush key for the border of a selected item in the property inspector toolbar.

PropertyInspectorToolBarSeparatorBrushKey
Gets the brush key for the separator in the property inspector toolbar.

PropertyInspectorToolBarTextBoxBorderBrushKey
Gets the brush key for the textbox border in the property inspector toolbar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top