MVVM Filtered + Filtering Event

2 posts, 0 answers
  1. Minh
    Minh avatar
    43 posts
    Member since:
    May 2014

    Posted 25 Feb 2016 Link to this post

    Hi, when using the GridViewSelectColumn filters, it deselects the selecteditems. So I use this bit of code to fix it 


    private void LoanGrid_OnFiltered(object sender, GridViewFilteredEventArgs e)
    public BindableCollection<LoanDTO> SelectedLoans { get; set; }
    private void LoanGrid_OnFiltering(object sender, GridViewFilteringEventArgs e)
        SelectedLoans = new BindableCollection<LoanDTO>();
        foreach (var selectedItem in LoanGrid.SelectedItems)

    That works perfectly fine, but I'm trying to have it be in MVVM format using caliburn.

    on xaml side,     cal:Message.Attach="[Filtered] = [Filtered];[Filtering] = [Filtering] "



    private BindableCollection<LoanDTO> _oldLoans = new BindableCollection<LoanDTO>();
    public void Filtered()
        SelectedLoans = new BindableCollection<LoanDTO>(Items.Where(x => _oldLoans.Any(y => y.Id == x.Id)));
    public void Filtering()
        _oldLoans = new BindableCollection<LoanDTO>();
        foreach (var selectedItem in SelectedLoans)


    The selecteditems get cleared using the MVVM methods. Any thoughts?

  2. Stefan
    Stefan avatar
    1073 posts

    Posted 01 Mar 2016 Link to this post

    Hi Minh,

    In order to handle a given event using the MVVM pattern, you can benefit from the EventToCommandBehavior mechanism. Can you please check it out and let me know how it goes?

    Stefan X1
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top