Based on Michael Giagnocavo's feedback, here's a cleaner version of my last post. Thanks Michael.

[ValidationState(ValidationState.Enabled)]

public partial class ExampleElement

{

    [ValidationMethod(ValidationCategories.Menu | ValidationCategories.Save)]

    private void TestExampleElement(ValidationContext context)

    {

        var propnames = this.Properties.Select( p => p.Name );

        var distinctnames = propnames.Distinct();

        if (propnames.Count() != distinctnames.Count())

        {

            context.LogError("Non-unique property names", "Error 1");

        }

 

        var subpropnames = this.Properties.SelectMany( p => p.SubProperties ).Select( p => p.Name );

        var distinctsubpropnames = subpropnames.Distinct();

 

        if (subpropnames.Count() != distinctsubpropnames.Count())

        {

            context.LogError("Non-unique sub property names", "Error 2");

        }

    }

}