Hello,
I have a RadDataForm that is bound to a collection of records. This form, when a record is edited should trigger an action in the view model that calls a web service to update the record in a downstream system. My ultimate challenge is that I do not know how to refer back to the ViewModel (or if it is even possible) from the Custom Command provider. Any help would be greatly appreciated!
Code Snippet from my XAML:
<telerik:RadDataForm Header="Balance Inquiry"
x:Name="IcsManualOpDataForm"
AutoGeneratingField="IcsManualOpForm_AutoGeneratingField"
ItemsSource="{Binding BalanceInq}"
AutoGenerateFields="True">
<telerik:RadDataForm.CommandProvider>
<commandProvider:IcsManualOpCommandProvider DataForm="{Binding ElementName=IcsManualOpDataForm}"/>
</telerik:RadDataForm.CommandProvider>
</telerik:RadDataForm>
The Custome Command provider (called IcsManualOpCommandProvider) is defined as follows:
public class IcsManualOpCommandProvider : DataFormCommandProvider
{
public IcsManualOpCommandProvider()
: base(null)
{
}
protected override void CommitEdit()
{
// TODO: call web service
this.DataForm.CommitEdit();
}
}
I have a RadDataForm that is bound to a collection of records. This form, when a record is edited should trigger an action in the view model that calls a web service to update the record in a downstream system. My ultimate challenge is that I do not know how to refer back to the ViewModel (or if it is even possible) from the Custom Command provider. Any help would be greatly appreciated!
Code Snippet from my XAML:
<telerik:RadDataForm Header="Balance Inquiry"
x:Name="IcsManualOpDataForm"
AutoGeneratingField="IcsManualOpForm_AutoGeneratingField"
ItemsSource="{Binding BalanceInq}"
AutoGenerateFields="True">
<telerik:RadDataForm.CommandProvider>
<commandProvider:IcsManualOpCommandProvider DataForm="{Binding ElementName=IcsManualOpDataForm}"/>
</telerik:RadDataForm.CommandProvider>
</telerik:RadDataForm>
The Custome Command provider (called IcsManualOpCommandProvider) is defined as follows:
public class IcsManualOpCommandProvider : DataFormCommandProvider
{
public IcsManualOpCommandProvider()
: base(null)
{
}
protected override void CommitEdit()
{
// TODO: call web service
this.DataForm.CommitEdit();
}
}