This project has moved and is read-only. For the latest updates, please go here.

PropertyGrid

Dec 6, 2013 at 8:01 PM
The Xaml designer is throwing the following error:
"Cannot modify TargetProperties once the definition has beed added to a collection."

on this line.
<xctk:EditorTemplateDefinition TargetProperties="EditorFont">
        <xctk:PropertyGrid x:Name="testPropertyGrid" Margin="10,10,10,72" ShowSearchBox="False" ShowSortOptions="False">
            <xctk:PropertyGrid.EditorDefinitions>
                <xctk:EditorTemplateDefinition TargetProperties="EditorFont">
                    <xctk:EditorTemplateDefinition.EditingTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Value.Family}" />
                                <TextBlock Text=", " />
                                <TextBlock Text="{Binding Value.FontSize}" />
                                <TextBlock Text=", " />
                                <TextBlock Text="{Binding Value.Weight}" />
                                <TextBlock Text=", " />
                                <TextBlock Text="{Binding Value.Style}" />
                                <TextBlock Text=", " />
                                <TextBlock Text="{Binding Value.Stretch}" />
                            </StackPanel>
                        </DataTemplate>
                    </xctk:EditorTemplateDefinition.EditingTemplate>
                </xctk:EditorTemplateDefinition>
            </xctk:PropertyGrid.EditorDefinitions>
        </xctk:PropertyGrid>
Otherwise the propertygrid works fine.

Mark
Jan 8, 2014 at 8:39 PM
I am getting the same error when specifying the TargetProperties property in a PropertyDefinition - like you apart from the blue squiggles and the error message (Cannot modify TargetProperties once the definition has beed added to a collection.) everything works as expected.

Windows 8.1, Visual Studio 2013 Premium, WPF Toolkit v4.0.30319
        <xctk:PropertyGrid AutoGenerateProperties="False" >
            <xctk:PropertyGrid.PropertyDefinitions>
                <xctk:PropertyDefinition TargetProperties="Prop1, Prop2 />
            </xctk:PropertyGrid.PropertyDefinitions>
        </xctk:PropertyGrid>
Jan 9, 2014 at 6:40 PM
I finally realized that learning to deal with such issues was taking me too far off of the original goal of creating the app. So I abandoned the PropertyGrid idea and moved on. I don't like having to write pages of code to get the job done if there is an already working solution.

Sadly it seems that as we progress with high level languages, what works is usually re-invented and then does not. Microsoft tends to deem things unnecessary and then discontinues them as well.

IMO this control need more work.
Jan 9, 2014 at 7:05 PM
@MarkFl

I understand your frustration - but I guess this is the community edition and I appreciate the work Xceed have done here.

Having said that yesterday I downloaded the trial version of the latest (v2.1) Plus product and had the same error. A work around for me is to revert to the (obsolete) 'Name' attribute but it does make me wonder if the control is the right way to move ahead. For now it is a quick way for me to edit complex and changing objects during the early development phase but questionable if it is production ready.

I'll post to the support site for the full product and see what the response is.
Developer
Sep 3, 2014 at 3:16 PM
Hi,

The error "Cannot modify TargetProperties once the definition has beed added to a collection." in XAML won't affect your program. It won't happen in v2.5.