Hi
my aim is create my own ADD, Edit, Delete and Cancel outside the build in menu strip.
I am having trouble trying to execute the commands outside the build in menu strip buttons, just wondering if any one can give an example on how to execute the events.( ADD, Edit, Delete and cancel )
cheers
Jason
my aim is create my own ADD, Edit, Delete and Cancel outside the build in menu strip.
I am having trouble trying to execute the commands outside the build in menu strip buttons, just wondering if any one can give an example on how to execute the events.( ADD, Edit, Delete and cancel )
cheers
Jason
8 Answers, 1 is accepted
0
Hi Jason,
Greetings,
Maya
the Telerik team
You may benefit from the built-in commands of the RadDataForm. For example:
<
StackPanel
Grid.Row
=
"1"
>
<
telerik:RadButton
Content
=
"Add"
Command
=
"telerik:RadDataFormCommands.AddNew"
CommandTarget
=
"{Binding ElementName=DataForm1}"
/>
<
telerik:RadButton
Content
=
"BeginEdit"
Command
=
"telerik:RadDataFormCommands.BeginEdit"
CommandTarget
=
"{Binding ElementName=DataForm1}"
/>
<
telerik:RadButton
Content
=
"Delete"
Command
=
"telerik:RadDataFormCommands.Delete"
CommandTarget
=
"{Binding ElementName=DataForm1}"
/>
</
StackPanel
>
Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jason
Top achievements
Rank 2
answered on 30 Jun 2011, 07:48 AM
cheers for the quick reply Maya
is there a way to access the command from the code behind?
cheers
Jason
is there a way to access the command from the code behind?
cheers
Jason
0
Hello Jason,
Regards,
Maya
the Telerik team
A command from the RadDataFormCommands can be defined and executed as follows:
private void RadButton_Click(object sender, RoutedEventArgs e)
{
var addNewCommand = RadDataFormCommands.AddNew as RoutedUICommand;
addNewCommand.Execute(null, this.DataForm1);
}
Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jason
Top achievements
Rank 2
answered on 30 Jun 2011, 08:41 AM
Great thank you very much for the quick response
Jason
Jason
0

Jason
Top achievements
Rank 2
answered on 30 Jun 2011, 09:42 AM
Just one more question, is it possible to load up the dataform as a add new item, if it is possible can you please kindly post an example
cheers
Jason
cheers
Jason
0
Hello Jason,
Kind regards,
Maya
the Telerik team
You may handle the Loaded event of the data form and call AddNewItem() method:
private void DataForm1_Loaded(object sender, RoutedEventArgs e)
{
this.DataForm1.AddNewItem();
}
Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jason
Top achievements
Rank 2
answered on 30 Jun 2011, 02:50 PM
Thanks for the solution, I am running into a problem, the add and delete button is disable when i load up the window, not sure why is doing this.
Jason
Jason
0

Jason
Top achievements
Rank 2
answered on 01 Jul 2011, 02:03 AM
I got it sorted but only the form part it doesn't actually write into the database I have bind it to itemessource
cheers