This project has moved. For the latest updates, please go here.

PropertyGrid Styling problem

Oct 15, 2012 at 8:27 PM

<xctk:PropertyDefinitionCollection x:Key="prova">
            <xctk:PropertyDefinition Name="Max"/>
            <xctk:PropertyDefinition Name="Min"/>
            <xctk:PropertyDefinition Name="Name"/>
            <xctk:PropertyDefinition Name="TextureIndex"/>
            <xctk:PropertyDefinition Name="Index"/>
            <xctk:PropertyDefinition Name="Color"/>
            <xctk:PropertyDefinition Name="Type"/>
        </xctk:PropertyDefinitionCollection>

        <xctk:PropertyDefinitionCollection x:Key="prova2">
            <xctk:PropertyDefinition Name="Max"/>
            <xctk:PropertyDefinition Name="Min"/>
            <xctk:PropertyDefinition Name="Name"/>
            <xctk:PropertyDefinition Name="TextureIndex"/>
            <xctk:PropertyDefinition Name="Type"/>
            <xctk:PropertyDefinition Name="Index"/>
            <xctk:PropertyDefinition Name="Color"/>
            <xctk:PropertyDefinition Name="Type"/>
            <xctk:PropertyDefinition Name="List"/>
            <xctk:PropertyDefinition Name="ColorTopMountain"/>
            <xctk:PropertyDefinition Name="IndexTextureTop"/>
            <xctk:PropertyDefinition Name="ModeAutomatic"/>
        </xctk:PropertyDefinitionCollection>

        <Style TargetType="xctk:PropertyGrid" x:Key="ColorStyle">
            <Setter Property="PropertyDefinitions" Value="{Binding Source={StaticResource prova}}"/>
            <Setter Property="Background" Value="Green"/>
             <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding Type}" Value="2"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="PropertyDefinitions" Value="{StaticResource prova2}"/>
                    <Setter Property="Background" Value="Red"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

 

 

I was trying to make a style for PropertyGrid, i just want to change the properties definitions at runtime.

But it seems impossible, do you have any idea about solving this problem?

Nov 16, 2012 at 6:55 PM

This works for me:

    PropertyDefinition pd = new PropertyDefinition();
    pd.Name = "Max";
    propertyGrid.PropertyDefinitions.Add(pd);

Nov 28, 2012 at 8:52 PM

This should be working as version 1.8