I have a MainWindowViewModel (DataContext) which exposes different ObservableCollections<> (viewmodels of the poco objects with INotifyProperty.... ).After selecting a value from a combobox i want to click a load button which then displays the desired data in a datagrid or listview. Problem is, that in the xaml code i can only define the itemssource and column specific definitions for one collection. So how can i change the data that is displayed in way that is compliant with MVVM. Are there any best practices?
相关问题
- Generic Generics in Managed C++
- VNC control for WPF application
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
相关文章
- .net中MessageBox.Show使用问题
- IdentityServer 报错:"idp claim is missing"
- 在 IdentityServer 中如何给 id token 添加更多信息
- WPF:如何在Trigger里修改Orientation?
- IdentityServer 的 Selector 在哪个 nuget 包
- 使用 IdentityServer 的项目遭遇错误:"IDX20803: Unable to obt
- ASP.NET Core ConfigureServices 中从 appsettings.json
- WPF aforge 怎么做一个 圆形的播放器
Create in your ViewModel a property that exposes an
IEnumerable
. Bind the DataGridsItemsSource
to that property. You can set then the property from inside the ViewModel to any of your collections and then the data will change.Please note that you should specify two-way binding and that your property must support some change-notification (support
INotifyPropertyChanged
or be aDependencyProperty
).