سؤال

I have a datagrid with validation rules. But I can not sort the grid on a column that contains a validation rule

Is it possible to sort a datagrid that contains validation rules?

Thanks.

هل كانت مفيدة؟

المحلول

Try this one: SortMemberPath="Complete"

<DataGrid.Columns>
<DataGridTemplateColumn Header="CustID" SortMemberPath="Complete" MinWidth="90"    CanUserSort="True" CanUserResize="True">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <Label Content="{Binding Path=CustID}"/>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

نصائح أخرى

There should not be any problem in sorting data grid column having validation rules as they are meant only to validate the data. Specify the data what you are trying to sort containing validation rules.

Well, we (I'm the co-developer) missed sort information since we are using datagrid columns templates : WPF4 Datagrid doesn't sort on column headers

It was indeed the cause of non sortable columns.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top