Hi Telerik ,
i have some problem to find a solution here for ..
first i am using RadGridView + MVVM + QueryableCollectionView.
The "pattern" is like this
My ViewModel has a property named "Nodes" which is a derived class of QueryableCollectionView which i am using because of paging feature.
The Problem i have is that the QueryableCollectionView is a wrapper for a IQueryable sourceCollection which is only set by constructor and there is not setter
for the wrapped source collection after its constructed.
So ok, i have done a workaround and creating a new Instance during RT of QueryableCollectionView with correct IQueryable parameter ( which by the way i do not have before ) and
set my ViewModel "Nodes" property to this new instance.
This works and i can see the Data correctly also paging works because the Grid gets notified about the change. ( it looks like so !)
In the "Nodes" Class i also have a "Command" property which is an Instance of a CommandProviderClass derived from prism.mvvm BindableBase ( which implements INotifyPropertyChanged )
and additionaly encapsulates a lot of other possible commands for Insert/Update/Delete .
And this "Command" property also gets replaced by the "newer" instance of "Nodes" because the Nodes Class holds this property.
My ViewModel has a wrapper to this Nodes.CommandProvider
BUT ...
So now my Problem is raised during the Event "RowValidating" i found that the User Control is still bound to old CommandProvider.DoValidatingRow
because
public ICommand DoValidatingRow { get; set; } // On Validate a Row
.... is initialized with
DoValidatingRow = new DelegateCommand<object>(OnValidatingRow);
But ICommand and DelegateCommand (Prism.Commands) Class have no INotifyPropertyChanged Contract defined.
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName ...
i already also called on my VM this.RaisePropertyChanged(""); before the validation is called but no effect. It´s doesn´t change!
A) So my main Question is how can i tell the User Control to refresh all of it´s bounded Class Instances ?
B) Maybe is there another solution to replace the wrapped Source Collection in QueryableCollectionView , because this will solve the original problem ?
thanks br thomas cinatl
<telerik:RadGridView x:Name="LookupListGridCtrl" ItemsSource="{Binding Nodes, Mode=TwoWay}" SelectedItem="{Binding Nodes.SelectedUiDataItem,Mode=TwoWay}" Grid.Row="1"
AutoGenerateColumns="false" GroupRenderMode="Flat" NewRowPosition="Top" SelectionMode="Single" SelectionUnit="FullRow"
CanUserDeleteRows="True" ScrollMode="Deferred" IsSynchronizedWithCurrentItem="True" CanUserResizeColumns="True" CanUserSearch="True"
RowIndicatorVisibility="Visible" Margin="0,0,0,1" ValidationType="Default"
FilteringMode="FilterRow" ShouldCloseFilteringPopupOnKeyboardFocusChanged="True"
>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding CommandProvider.DoDeleteRow}" EventName="Deleted" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoInsertRow}" EventName="RowEditEnded" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoAddNew}" EventName="AddingNewDataItem" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingCell}" EventName="CellValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName="RowValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoSelectionChanging}" EventName="SelectionChanging" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
</telerik:EventToCommandBehavior.EventBindings>
i have some problem to find a solution here for ..
first i am using RadGridView + MVVM + QueryableCollectionView.
The "pattern" is like this
My ViewModel has a property named "Nodes" which is a derived class of QueryableCollectionView which i am using because of paging feature.
The Problem i have is that the QueryableCollectionView is a wrapper for a IQueryable sourceCollection which is only set by constructor and there is not setter
for the wrapped source collection after its constructed.
So ok, i have done a workaround and creating a new Instance during RT of QueryableCollectionView with correct IQueryable parameter ( which by the way i do not have before ) and
set my ViewModel "Nodes" property to this new instance.
This works and i can see the Data correctly also paging works because the Grid gets notified about the change. ( it looks like so !)
In the "Nodes" Class i also have a "Command" property which is an Instance of a CommandProviderClass derived from prism.mvvm BindableBase ( which implements INotifyPropertyChanged )
and additionaly encapsulates a lot of other possible commands for Insert/Update/Delete .
And this "Command" property also gets replaced by the "newer" instance of "Nodes" because the Nodes Class holds this property.
My ViewModel has a wrapper to this Nodes.CommandProvider
BUT ...
So now my Problem is raised during the Event "RowValidating" i found that the User Control is still bound to old CommandProvider.DoValidatingRow
because
public ICommand DoValidatingRow { get; set; } // On Validate a Row
.... is initialized with
DoValidatingRow = new DelegateCommand<object>(OnValidatingRow);
But ICommand and DelegateCommand (Prism.Commands) Class have no INotifyPropertyChanged Contract defined.
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName ...
i already also called on my VM this.RaisePropertyChanged(""); before the validation is called but no effect. It´s doesn´t change!
A) So my main Question is how can i tell the User Control to refresh all of it´s bounded Class Instances ?
B) Maybe is there another solution to replace the wrapped Source Collection in QueryableCollectionView , because this will solve the original problem ?
thanks br thomas cinatl
<telerik:RadGridView x:Name="LookupListGridCtrl" ItemsSource="{Binding Nodes, Mode=TwoWay}" SelectedItem="{Binding Nodes.SelectedUiDataItem,Mode=TwoWay}" Grid.Row="1"
AutoGenerateColumns="false" GroupRenderMode="Flat" NewRowPosition="Top" SelectionMode="Single" SelectionUnit="FullRow"
CanUserDeleteRows="True" ScrollMode="Deferred" IsSynchronizedWithCurrentItem="True" CanUserResizeColumns="True" CanUserSearch="True"
RowIndicatorVisibility="Visible" Margin="0,0,0,1" ValidationType="Default"
FilteringMode="FilterRow" ShouldCloseFilteringPopupOnKeyboardFocusChanged="True"
>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding CommandProvider.DoDeleteRow}" EventName="Deleted" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoInsertRow}" EventName="RowEditEnded" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoAddNew}" EventName="AddingNewDataItem" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingCell}" EventName="CellValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoValidatingRow}" EventName="RowValidating" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
<telerik:EventBinding Command="{Binding CommandProvider.DoSelectionChanging}" EventName="SelectionChanging" RaiseOnHandledEvents="True" PassEventArgsToCommand="True" />
</telerik:EventToCommandBehavior.EventBindings>