我可以选中一个复选框,但当我点击另一个复选框时,前一个复选框将被删除。任何帮助将不胜感激。
<telerik:RadGridView Name="Grid" ItemsSource="{Binding Items}" RowIndicatorVisibility="Collapsed" SelectionMode="Multiple">
<telerik:RadGridView.Columns>
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding CheckAll}">
<telerik:GridViewCheckBoxColumn.GroupHeaderTemplate>
<DataTemplate>
<CheckBox Checked="CheckAll_Checked" Unchecked="CheckAll_Checked" />
</DataTemplate>
</telerik:GridViewCheckBoxColumn.GroupHeaderTemplate>
</telerik:GridViewCheckBoxColumn>
<telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding Date, StringFormat=d}"/>
<telerik:GridViewDataColumn Header="Loan Account" DataMemberBinding="{Binding AccountNumber}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView >
检查代码,我希望这是你所指的:
private void CheckAll_Checked(object sender, RoutedEventArgs e)
{
Grid.Items.OfType<CashFlowDTO>().ToList().ForEach(x => x.Post = CheckAll);
}