This question is locked. New answers and comments are not allowed.
hi,
i want to bind the grids row double click event to a command in my view model where i need to paas the entire row object as parameter. can you send me a demo code for this. or help me with some code sample.
i want to bind the grids row double click event to a command in my view model where i need to paas the entire row object as parameter. can you send me a demo code for this. or help me with some code sample.
4 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
The closest option we can offer you is illustrated on this demo:
http://demos.telerik.com/silverlight/#GridView/ClickEvents
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
preeti
Top achievements
Rank 1
answered on 17 Aug 2012, 04:22 AM
cant i have a command bound to a click event. is that not possible?
0
Hello,
Vlad
the Telerik team
You can use EventToCommand in Blend.
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Arkadiusz
Top achievements
Rank 1
answered on 23 Aug 2012, 11:04 AM
This is solution we are using, please note that u have to start using your namespace and assembly in xaml instead of defaults:
It could be easily rewrote into attachable property which is probably better solution.
It could be easily rewrote into attachable property which is probably better solution.
public
class
YoursRadGridView : Telerik.Windows.Controls.RadGridView
{
public
YoursRadGridView ()
{
doubleClickHandler =
new
MouseButtonEventHandler((sender, args) =>
{
if
(args.ClickCount % 2 == 0)
if
(DoubleClickRowCommand !=
null
)
DoubleClickRowCommand.Execute(SelectedItem);
});
RowLoaded += (s, e) =>
{
e.Row.AddHandler(GridViewRow.MouseLeftButtonDownEvent, doubleClickHandler,
true
);
};
RowUnloaded += (s, e) =>
{
e.Row.RemoveHandler(GridViewRow.MouseLeftButtonDownEvent, doubleClickHandler);
};
}
public
ICommand DoubleClickRowCommand
{
get
{
return
(ICommand)GetValue(DoubleClickRowCommandProperty); }
set
{ SetValue(DoubleClickRowCommandProperty, value); }
}
// Using a DependencyProperty as the backing store for SelectedItemsEx. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty DoubleClickRowCommandProperty =
DependencyProperty.Register(
"DoubleClickRowCommand"
,
typeof
(ICommand),
typeof
(MsRadGridView),
new
PropertyMetadata(
null
));
MouseButtonEventHandler doubleClickHandler;
}