I have a program running under WPF and MVVM. I have some daily worked hours information that I can show in a daily, weekly or monthly view.
I did that using three data grids and showing only the one users want by binding the Visible property of them. The problem es that those three grids are bound to an observable collection so the view is asking for information although this is not being shown. Is it possible to deactivate the data binding feature of some element by any property?
You can simply set the
ItemsSourcefor the data grids that you don’t display tonull.You can also automate this by using a
MultiBindingfor theItemsSourcealong with a customIMultiValueConverter. The converter would bind to two values (the source collection and the grid’sVisibility) and return the collection itself if the grid is visible ornullif it’s not. The binding itself can be one-way.