Sean, your videos are always extremely helpful and I've learned a lot from them. I have one question: What happens if the ObservableCollection is loaded async into an async ViewModel, like in your MVVM full stack episode #4 ? Having tried this, the ObservableCollection gets hydrated after the view model is returned, so placing the CollectionViewSource initialization in the ViewModel constructor or the static "factory" method you create in that episode results in the CollectionView never getting populated. What would be an elegant solution for this ?
Hmm I could see how that would be helpful. I'm interested in how something like that would be implemented. Good questions Fernando, I'll have this in the back of my mind.
My application views are eventually bound to a database search query collection which is a subset of the entire db as filtered by the query. This can still be a lot of data. The resulting query has many more useful column elements than I want to display at first. What I actually would actually like to be able to do is selectively enable a subset of those data columns making them visible then have a user control which can dynamically enable/disable the visibility of other columns having useful data by using some sort of column enable/disable visibility selector mechanism.
Hey Kent, I've seen this use case implemented before. As you've probably already discovered, there is no Visibility property on GridViewColumns. The best alternative to hide a GridViewColumn is to set the Width to 0 and set the GridViewColumnHeader's IsEnabled to false to prevent resizing. That said, you could bind these 2 properties to a checkbox with converters. Hope that helps spark some ideas, Kent!
Hi thank u so much for your time&efforts here but I have a qst : List and every single Room have some Desktop so my List is a list of a list of Desktop how i could visualize all of this in a listBox with the template of subItem that mean that i see something like this: Room a Desktop 101 Desktop 104 Room b Desktop 234 Desktop 123 Desktop 453 Desktop 498 Room c Desktop 365 Desktop 908 Desktop 187 Room d Desktop 007 Room n Desktop 980 Desktop 1001 As we know in the list they re already grouped by a room ;) I am using json for import the list In a Wpf desktop app Thank u in advice
Hi Sean - thanks once again for your great video. I’ve followed your 4 hour video on creating a .net 5 MVVM WPF app, applying the principles to my use case. I now need to filter the list view via a text box and was going to use your video but it seems ICollectionView isn’t available in .net 5 or 6. Are you aware of what alternatives are available? I’ll continue searching but perhaps a side tutorial extending the CZcams viewers app with this capability would be brilliant. I completely understand if you’re busy on other projects though. Thanks for your time. Roy
Hi @@SingletonSean - that is strange. Yes I can import System.Component model namespace into my view model class but ICollectionView doesn’t come up. I’m using .Net 6 too. The Microsoft api doc doesn’t list any core or .net versions in the Applies to section. I wonder how you’ve been able to get it to work
How to use this CollectionView if I bind to the Model in the code-behind like this: var newBinding = new Binding(string.Format("[{0}]", i)); var currentColumn = new DataGridTextColumn { Binding = newBinding, Header = header }; MyDataGrid.Columns.Add(currentColumn);
Very nice video, have you found a good solution for sorting groups? The best way I've got is making sure to populate the collection in the right order. But that's not dynamic or often even possible.
Hey ShineyBorel, I've actually never run into this kind of requirement in an application, but I am interested in messing around with this and seeing if there's a way to sort groups.
As always, this is another awesome tutorial. Thank you very much for the great explanation 👍
Much needed tutorial thank you !
Thank you so much for making this video. :)
Thanks Sean!
thanks! perfect lesson
explains a lot, thanks
another perfect lesson.
Great work 👏
Sean, your videos are always extremely helpful and I've learned a lot from them. I have one question: What happens if the ObservableCollection is loaded async into an async ViewModel, like in your MVVM full stack episode #4 ? Having tried this, the ObservableCollection gets hydrated after the view model is returned, so placing the CollectionViewSource initialization in the ViewModel constructor or the static "factory" method you create in that episode results in the CollectionView never getting populated. What would be an elegant solution for this ?
Really nice!! I did something very similar in my application. But how to highlight the search text? Maybe a style inside the xaml listview?
Hmm I could see how that would be helpful. I'm interested in how something like that would be implemented. Good questions Fernando, I'll have this in the back of my mind.
@@SingletonSean Yes, because if you have a large data table with long phrases it's hard to see why that result was filtered.
Thanks SingletonSean for this video, could you please activate subtitles? please please.
How is it possible to make a new DataGrid and show how many for example Doctor is in list?
My application views are eventually bound to a database search query collection which is a subset of the entire db as filtered by the query. This can still be a lot of data. The resulting query has many more useful column elements than I want to display at first. What I actually would actually like to be able to do is selectively enable a subset of those data columns making them visible then have a user control which can dynamically enable/disable the visibility of other columns having useful data by using some sort of column enable/disable visibility selector mechanism.
Hey Kent, I've seen this use case implemented before. As you've probably already discovered, there is no Visibility property on GridViewColumns. The best alternative to hide a GridViewColumn is to set the Width to 0 and set the GridViewColumnHeader's IsEnabled to false to prevent resizing. That said, you could bind these 2 properties to a checkbox with converters. Hope that helps spark some ideas, Kent!
@@SingletonSean Thanks. That is an approach that I will try to see how well it might work.
I want to make filtering to datagrid with datatable or dataview not observable collection.i try it but the datagrid didn't updated anywhere
I am working on mvvm with sql database and want to make text box filer for the data grid . I benefited alot from your channel
Hi thank u so much for your time&efforts here but I have a qst : List and every single Room have some Desktop so my List is a list of a list of Desktop how i could visualize all of this in a listBox with the template of subItem that mean that i see something like this:
Room a
Desktop 101
Desktop 104
Room b
Desktop 234
Desktop 123
Desktop 453
Desktop 498
Room c
Desktop 365
Desktop 908
Desktop 187
Room d
Desktop 007
Room n
Desktop 980
Desktop 1001
As we know in the list they re already grouped by a room ;)
I am using json for import the list
In a Wpf desktop app
Thank u in advice
Hi Sean - thanks once again for your great video. I’ve followed your 4 hour video on creating a .net 5 MVVM WPF app, applying the principles to my use case. I now need to filter the list view via a text box and was going to use your video but it seems ICollectionView isn’t available in .net 5 or 6. Are you aware of what alternatives are available? I’ll continue searching but perhaps a side tutorial extending the CZcams viewers app with this capability would be brilliant. I completely understand if you’re busy on other projects though. Thanks for your time. Roy
Hello Roy! I am on .NET 6 and am able to use ICollectionView. Are you able to import System.ComponentModel?
Hi @@SingletonSean - that is strange. Yes I can import System.Component model namespace into my view model class but ICollectionView doesn’t come up. I’m using .Net 6 too. The Microsoft api doc doesn’t list any core or .net versions in the Applies to section. I wonder how you’ve been able to get it to work
Same issue here. have you found any solution to this issue?
How to use this CollectionView if I bind to the Model in the code-behind like this:
var newBinding = new Binding(string.Format("[{0}]", i));
var currentColumn = new DataGridTextColumn
{
Binding = newBinding,
Header = header
};
MyDataGrid.Columns.Add(currentColumn);
The solution is - it works the same way just need to re-create and refresh collectionView after each Serialization
Very nice video, have you found a good solution for sorting groups? The best way I've got is making sure to populate the collection in the right order. But that's not dynamic or often even possible.
Hey ShineyBorel, I've actually never run into this kind of requirement in an application, but I am interested in messing around with this and seeing if there's a way to sort groups.
I was wondering if you can apply the same concept on Treeview?
Yep, I've used this before on a TreeView ItemsSource.
Can I dowoad the source code?
love your contribute and learnt a lot...first time I have spended thru paypal @lalji Goti ....Thanks
Thanks so much Lalji, the contributions are greatly appreciated! I'm glad my content is helping you as well.
Maybe you should use Rx.Net
Started getting into Rx a lot more recently, I love it! I agree, filtering is a pretty good use case for Rx.