This is a migrated thread and some comments may be shown as answers.

Bind visible items from view model

5 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 14 Nov 2015, 02:44 PM

Assuming the following view model. How do I bind the VisibleItems collection to the RadGridView? One-Way binding would be sufficient, as I would deactivate any filtering from the UI side. Performance is important.

public class ViewModel
{
    public ObservableCollection<Item> AllItems { get; set; }
    public ObservableCollection<Item> VisibleItems { get; set; }  
}
  
public class Item
{
    public string Name { get; set; }
}

​Cheers,

Jan

 

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Nov 2015, 10:33 AM
Hello Jan,

I already replied you in the support ticket you opened regarding this question. In order to avoid double posting, I would kindly ask you to continue any further communication regarding this case in it.

Best Regards,
Stefan
Telerik
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
0
Иван
Top achievements
Rank 1
answered on 21 Jun 2018, 12:28 PM

Hello, Stefan.

Can you share information for all? I also need same possibility. Thank you.

0
Stefan
Telerik team
answered on 26 Jun 2018, 09:48 AM
Hello Ivan,

The approach discussed in the given support thread consisted of defining an IsVisible boolean property for the business model and applying a filtering criteria over it. Attached to my reply you can find the sample application demonstrating it. However, I am not completely sure that it would correspond to your scenario. Can you please elaborate a bit on your exact requirement?

Regards,
Stefan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Ivan
Top achievements
Rank 1
answered on 03 Jul 2018, 11:59 AM

Thank you, Stefan, for your answer. Unfortunately this approach is not fit for my task. My task is opposite:

User using filtration in header of columns decrease set of data. Then user wants to select all (but only all filtered records).And I try to find the way how to gat list of filtered items. I have tried to use

item.IsSelected = GridViewGetRowForItem(item) != null;

But it work only for items which are showing on screen (and does not works for records not fitted into screen, at the end of the list).

Can you give me an advice how to solve it.

 

0
Ivan
Top achievements
Rank 1
answered on 03 Jul 2018, 12:36 PM

Ah, just need to use GridView.Items - all items in this list. 

Sorry, my question is closed.

Tags
GridView
Asked by
Jan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Иван
Top achievements
Rank 1
Ivan
Top achievements
Rank 1
Share this question
or