This is a migrated thread and some comments may be shown as answers.

GridViewToggleRowDetailsColumn button does not select row

5 Answers 224 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 13 May 2010, 03:06 PM
Hi,

I am using Silverlight 4 and the latest Telerik build.  I am having a problem with using a GridViewToggleRowDetailsColumn button with a RadGridView.  When I click the '+' sign on a row to show the RowDetails, it does not select the row at the same time.  I can expand other rows but the RowDetails only show for the selected row, which can be different from the expanded row. I have attached a screenshot to help explain.  Can anyone point me in the right direction?

Thanks,

Matt

5 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 13 May 2010, 03:23 PM
Hi Matthias,

The purpose of the GridViewToggleRowDetailsColumn is to expand row details - it will not select the respective item. If you would like to select row details when they are expanded you could try something like this:

// subscribe to RowDetailsVisibilityChanged
private void RadGridView_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
{
    if (e.Visibility.Value == System.Windows.Visibility.Visible)
    {
        e.Row.IsSelected = true;
    }
}


All the best,
Milan
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
Matthias
Top achievements
Rank 1
answered on 13 May 2010, 03:38 PM
That's exactly what I was looking for :)

Thanks!
0
Sadi
Top achievements
Rank 1
answered on 01 Mar 2012, 08:01 PM
Is there a better solution to this out now..? How is it supposed to be implemented in MVVM.
0
Vlad
Telerik team
answered on 02 Mar 2012, 07:59 AM
Hello,

 You can use attached behavior with the same if you want reusable MVVM style code. 

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subhendu
Top achievements
Rank 1
answered on 26 Mar 2013, 06:28 AM
A sample implementation of attached propertey (Not the beahaviour )

public
static class CommandProvider
   {
       public static ICommand GetCommand(DependencyObject obj)
       {
           return (ICommand)obj.GetValue(CommandProperty);
       }
 
       public static void SetCommand(DependencyObject obj, ICommand value)
       {
           obj.SetValue(CommandProperty, value);
       }
 
      public static readonly DependencyProperty CommandProperty =
           DependencyProperty.RegisterAttached(
               "Command",
               typeof(ICommand),
               typeof(CommandProvider),
               new PropertyMetadata(
                   default(ICommand),
                   new PropertyChangedCallback(HandleCommandChangedCallback)));
 
 
   public static void HandleCommandChangedCallback(
           DependencyObject dependencyObject,
           DependencyPropertyChangedEventArgs eventArgs)
       {
         if (dependencyObject is RadGridView)
           {
               var radGrid = dependencyObject as RadGridView;
 
               if (radGrid != default(RadGridView))
               {
                   radGrid.RowDetailsVisibilityChanged += (sender, args) =>
                       {
                           if (args.Visibility.Value ==Visibility.Visible )
                           {
                               args.Row.IsSelected = true;
                           }
                       };
               }
           }
       }
   }
and in XAML :
<telerik:RadGridView extensibility:CommandProvider.Command="{Binding RowVisibilityChanged}">

RowVisibilityChanged is you RelayCommand.
Tags
GridView
Asked by
Matthias
Top achievements
Rank 1
Answers by
Milan
Telerik team
Matthias
Top achievements
Rank 1
Sadi
Top achievements
Rank 1
Vlad
Telerik team
Subhendu
Top achievements
Rank 1
Share this question
or