Хм, я могу добавить SortDescription для логического свойства в моем примере списка!
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<ListBox x:Name="box" DisplayMemberPath="Test" />
</Grid>
</Window>
Код:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
//4 instances, each with a property Test of another boolean value
box.ItemsSource = new[] {
new {Test = true},
new {Test = false},
new {Test = false},
new {Test = true}
};
box.Items.SortDescriptions.Add(new SortDescription("Test", ListSortDirection.Descending));
}
}
public class BooleanHolder
{
public bool Test { get; set; }
}
Работает как шарм;)
Возможно, вы неправильно написали имя свойства в объекте SortDescription? Надеюсь, это поможет
В вашем примере вы определили Prop как поле. Сделайте это свойством, и оно будет работать;)
public class A
{
public bool Prop { get; set; }
}