Ist euch folgendes Verhalten bekannt: die Sortierung in der PropertyGrid stimmt nicht mehr, wenn mehrere Objekte ausgewählt sind. Form mit einer PropertyGrid und zwei buttons und eine Klasse TestObject. - Ein Objekt in der PropertyGrid = sortiert nach "DisplayName" - Mehrere Objekte in der PropertyGrid = sortiert nach "PropertyName"
Beispiel Project (VB.NET):
Public Class testpropertygrid
Private obj1 As TestObject = New TestObject Private obj2 As TestObject = New TestObject
Private Sub testpropertygrid_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load PropertyGrid1.SelectedObject = Nothing End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click PropertyGrid1.SelectedObject = obj1 End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click PropertyGrid1.SelectedObjects = New Object() {obj1, obj2} End Sub
End Class
Public Class TestObject <Description("The name of this property begins with the letter a. But the displayName with the letter z"), DisplayName("Z like ze end"), Browsable(True)> Public Property aaaaaa As String
<Description("The name of this property begins with the letter a. But the displayName with the letter m"), DisplayName("M like middle")> Public Property aaaa As String
<Description("The name of this property begins with the letter z. But the displayName with the letter b"), DisplayName("B like begin")> Public Property zzzz As String
Habe den Code in VB.net übersetzt und so angepasst, dass (oder Angabe eines PropertyOrderAttribute) nach DisplayName anstelle Name sortiert wird. Bei Interesse melden.