如何基于MultiBinding对WPF MultiBinding DataGridTextColumn进行排序?

时间:2015-12-14 05:33:17

标签: wpf sorting wpfdatagrid multibinding datagridtextcolumn

我想根据多重绑定值对DataGridTextColumn进行排序 - 文本列与日期和时间绑定,因此排序操作应基于 DateTime 完成。

XMAL源代码

{!! Form::open() !!}

视图和视图模型C#源代码是

<DataGridTextColumn Header="Visit Date" CanUserSort="True" >
    <DataGridTextColumn.SortMemberPath>
        <MultiBinding StringFormat="{}{0} {1}">
            <Binding Path="VisitDate"/>
            <Binding Path="VisitTime" />
        </MultiBinding>
    </DataGridTextColumn.SortMemberPath>
    <DataGridTextColumn.Binding>
        <MultiBinding StringFormat="{}{0} {1}">
            <Binding Path="VisitDate"/>
            <Binding Path="VisitTime" />
        </MultiBinding>
    </DataGridTextColumn.Binding>
</DataGridTextColumn>

0 个答案:

没有答案