Hello Telerik
I have a WPF application with UserControls. One UserControl contains a RdGridView (DataView/DataViewModel). The application can switch between some several UserControls
like this:
xaml:
MainWindowViewModel C#:
The RadGridView is bound to a QueryableEntityCollectionView property (Suppliers) of the DataViewModel using the EntityFramework.
On one button in the MainWindowViewMode I set a Filter before switching to the DataView via MVVM Light messaging in the DataViewModel:
On another button (in the MainWindowViewMode ) I change the sort order before switching to the DataView:
With EventToCommand from MVVM Light I call a function RowLoaded in the DataViewModel to format the cells.
So far so good.
The problem is that sometimes the RowLoaded even is not called, when I switch from one UserControl to the UserControl containing the RadGridView. It seems that something happened to the GridView when the UserControl is switching to another UserControl.
I hope I have explained it well enough to understand the architecture.
Thank you in advance Uwe
I have a WPF application with UserControls. One UserControl contains a RdGridView (DataView/DataViewModel). The application can switch between some several UserControls
like this:
xaml:
<
Window.Resources
>
<
DataTemplate
DataType
=
"{x:Type local.viewmodels:WellcomeViewModel}"
>
<
local.views:WellcomeView
/>
</
DataTemplate
>
<
DataTemplate
DataType
=
"{x:Type local.viewmodels:DataViewModel}"
>
<
local.views:CurrentDataView
/>
</
DataTemplate
>
…
</
Window.Resources
>
MainWindowViewModel C#:
CurrentPageViewModel = PageViewModels.Find(vm => vm.ToString() ==
"WPFPageApp.ViewModels.CurrentDataViewModel"
);
The RadGridView is bound to a QueryableEntityCollectionView property (Suppliers) of the DataViewModel using the EntityFramework.
On one button in the MainWindowViewMode I set a Filter before switching to the DataView via MVVM Light messaging in the DataViewModel:
DateTime toDay = DateTime.Now.Date;
Suppliers.FilterDescriptors.Add(
new
FilterDescriptor(
"InsertDate"
, FilterOperator.IsGreaterThanOrEqualTo, toDay));
On another button (in the MainWindowViewMode ) I change the sort order before switching to the DataView:
Suppliers.SortDescriptors.Add(
new
SortDescriptor()
{
Member =
"Id"
,
SortDirection = System.ComponentModel.ListSortDirection.Descending
});
With EventToCommand from MVVM Light I call a function RowLoaded in the DataViewModel to format the cells.
So far so good.
The problem is that sometimes the RowLoaded even is not called, when I switch from one UserControl to the UserControl containing the RadGridView. It seems that something happened to the GridView when the UserControl is switching to another UserControl.
I hope I have explained it well enough to understand the architecture.
Thank you in advance Uwe