GridViewToggleRowDetailsColumn button does not select row

6 posts, 1 answers
  1. Matthias
    Matthias avatar
    2 posts
    Member since:
    May 2010

    Posted 13 May 2010 Link to this post

    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
  2. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 13 May 2010 Link to this post

    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.
  3. DevCraft banner
  4. Matthias
    Matthias avatar
    2 posts
    Member since:
    May 2010

    Posted 13 May 2010 Link to this post

    That's exactly what I was looking for :)

    Thanks!
  5. Sadi
    Sadi avatar
    7 posts
    Member since:
    Feb 2012

    Posted 01 Mar 2012 Link to this post

    Is there a better solution to this out now..? How is it supposed to be implemented in MVVM.
  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Mar 2012 Link to this post

    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 >>
  7. Subhendu
    Subhendu avatar
    10 posts
    Member since:
    Mar 2013

    Posted 26 Mar 2013 Link to this post

    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.
Back to Top
DevCraft banner