This question is locked. New answers and comments are not allowed.
I have a radgrid view when I click in a row it opens a radwindow with a DataTemplate to edit the record of the respective row.
I need to have 2 Buttons inside the Template, one to Save or update the record, the other to cancel the editing of the record.
< DataTemplate x:Key="RowDetailsTemplate">
<Grid>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="150" />
<ColumnDefinition Width="230"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="230"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Margin="5,5,5,2" Text="Name: " VerticalAlignment="Center" Foreground="Black" />
<TextBox x:Name="textBox1" Grid.Row="0" Grid.Column="1" Margin="5,5,5,2" Height="24" Text="{Binding Name, Mode=TwoWay}" VerticalContentAlignment="Center" />
<TextBlock Grid.Row="1" Grid.Column="0" Margin="5,2,5,2" Text="Established: " VerticalAlignment="Center" Foreground="Black" />
<telerik:RadDatePicker Grid.Row="1" Grid.Column="1" Margin="5,2,5,2" Height="24" DateTimeText="{Binding Established,Mode=TwoWay}" VerticalContentAlignment="Center" />
<TextBlock Grid.Row="2" Grid.Column="0" Margin="5,2,5,2" Text="StadiumCapacity: " VerticalAlignment="Center" Foreground="Black" />
<TextBox Grid.Row="2" Grid.Column="1" Margin="5,2,5,2" Height="24" Text="{Binding StadiumCapacity,Mode=TwoWay}" VerticalContentAlignment="Center" />
<telerik:RadButton Grid.Row="3" Grid.Column="0" Width="150" Content="Save" Click="RadButton_Click_1">
<swi:Interaction.Triggers>
<swi:EventTrigger EventName="Click" x:Name="Save">
<swi:InvokeCommandAction Command="{Binding editCommand, Source={StaticResource telerikGridViewCommands}}"
CommandParameter="{Binding }"/>
</swi:EventTrigger>
</swi:Interaction.Triggers>
</telerik:RadButton>
<telerik:RadButton x:Name="Cancel" Grid.Row="3" Grid.Column="1" Width="150" Content="Cancel" Click="RadButton_Click">
<swi:Interaction.Triggers>
<swi:EventTrigger EventName="Click" x:Name="Cancel">
<swi:InvokeCommandAction Command="{Binding cancelCommand, Source={StaticResource telerikGridViewCommands}}"
CommandParameter="{Binding }"/>
</swi:EventTrigger>
</swi:Interaction.Triggers>
</telerik:RadButton>
</Grid>
</DataTemplate>
I have a class with the 2 ICommands
public class TelerikGridViewCommands
{
//public ICommand deleteCommand
//{
// get
// {
// return RadGridViewCommands.Delete;
// }
//}
public ICommand cancelCommand
{
get
{
return RadGridViewCommands.CancelRowEdit;
}
}
public ICommand editCommand
{
get
{
return RadGridViewCommands.CommitEdit;
}
}
}
The problem is that it always catches the editCommand event.
It seems that being this one registed first the other buttons, inclusive the close button of the radwindow does the CommitEdit
Event.
Can you help me here?
Thanks in advanced
I need to have 2 Buttons inside the Template, one to Save or update the record, the other to cancel the editing of the record.
< DataTemplate x:Key="RowDetailsTemplate">
<Grid>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="150" />
<ColumnDefinition Width="230"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="230"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Margin="5,5,5,2" Text="Name: " VerticalAlignment="Center" Foreground="Black" />
<TextBox x:Name="textBox1" Grid.Row="0" Grid.Column="1" Margin="5,5,5,2" Height="24" Text="{Binding Name, Mode=TwoWay}" VerticalContentAlignment="Center" />
<TextBlock Grid.Row="1" Grid.Column="0" Margin="5,2,5,2" Text="Established: " VerticalAlignment="Center" Foreground="Black" />
<telerik:RadDatePicker Grid.Row="1" Grid.Column="1" Margin="5,2,5,2" Height="24" DateTimeText="{Binding Established,Mode=TwoWay}" VerticalContentAlignment="Center" />
<TextBlock Grid.Row="2" Grid.Column="0" Margin="5,2,5,2" Text="StadiumCapacity: " VerticalAlignment="Center" Foreground="Black" />
<TextBox Grid.Row="2" Grid.Column="1" Margin="5,2,5,2" Height="24" Text="{Binding StadiumCapacity,Mode=TwoWay}" VerticalContentAlignment="Center" />
<telerik:RadButton Grid.Row="3" Grid.Column="0" Width="150" Content="Save" Click="RadButton_Click_1">
<swi:Interaction.Triggers>
<swi:EventTrigger EventName="Click" x:Name="Save">
<swi:InvokeCommandAction Command="{Binding editCommand, Source={StaticResource telerikGridViewCommands}}"
CommandParameter="{Binding }"/>
</swi:EventTrigger>
</swi:Interaction.Triggers>
</telerik:RadButton>
<telerik:RadButton x:Name="Cancel" Grid.Row="3" Grid.Column="1" Width="150" Content="Cancel" Click="RadButton_Click">
<swi:Interaction.Triggers>
<swi:EventTrigger EventName="Click" x:Name="Cancel">
<swi:InvokeCommandAction Command="{Binding cancelCommand, Source={StaticResource telerikGridViewCommands}}"
CommandParameter="{Binding }"/>
</swi:EventTrigger>
</swi:Interaction.Triggers>
</telerik:RadButton>
</Grid>
</DataTemplate>
I have a class with the 2 ICommands
public class TelerikGridViewCommands
{
//public ICommand deleteCommand
//{
// get
// {
// return RadGridViewCommands.Delete;
// }
//}
public ICommand cancelCommand
{
get
{
return RadGridViewCommands.CancelRowEdit;
}
}
public ICommand editCommand
{
get
{
return RadGridViewCommands.CommitEdit;
}
}
}
The problem is that it always catches the editCommand event.
It seems that being this one registed first the other buttons, inclusive the close button of the radwindow does the CommitEdit
Event.
Can you help me here?
Thanks in advanced