GridViewToggleRowDetailsColumn Toggle Button Binding

7 posts, 0 answers
  1. Jason
    Jason avatar
    25 posts
    Member since:
    Aug 2012

    Posted 16 Jun 2011 Link to this post

    Hello,

    I am using GridViewRowDetails to display information regarding a row in a GridView.  I am using the GridViewToggleRowDetailsColumn to toggle the information off and on.  I am developing with the MVVM pattern and extensive databinding.  I want to be able to hide the plus sign on a per row basis using binding.  In addition I would like to be able to toggle the button in my ViewModel code as needed.  Do you have any suggestions on how this can be accomplished using MVVM and binding?

    Thanks,

    Jason

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    971 posts
    Member since:
    Dec 2014

    Posted 20 Jun 2011 Link to this post

    Hello Jason,

    The main point here is that GridViewToggleRowDetailsColumn does not inherit from GridViewBoundColumnBase, so that it has no exposed DataMemberBinding property. I would advise yout to design a custom column that mimics the GridViewToggleRowDetailsColumn's features and inherits from GridViewBoundColumnBase. I have prepared an example project that illustrates this approach. Please, refer to it and do not hesitate to contact us immediately if any further inquiries occur.

    Kind regards,
    Ivan Ivanov
    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. Download a free trial of UI for WPF
  4. Jason
    Jason avatar
    25 posts
    Member since:
    Aug 2012

    Posted 20 Jun 2011 Link to this post

    Great, I downloaded the project.  I added 2 buttons to the main view, one for collapse all and one for expand all.  I bound the buttons to a DelegateCommand which executes methods that iterate through the Club model and set the IsExpanded property appropriately.  The IsExpanded setter calls the OnPropertyChanged method to push the changes to the ui.  This works well and the UI is updated the way that I want.  So half of my problem is solved.  I am still looking for a way to hide the button entirely by binding a property from the Club object to a Visibility in the XAML.  Do you think that you can help out with that.

    Thanks,

    Jason

  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    971 posts
    Member since:
    Dec 2014

    Posted 21 Jun 2011 Link to this post

    Hi Jason,

    I would advise you to expose an additional property that implements this functionality. The original GridViewToggleRowDetailsColumn has a ToggleButtonStyleProperty, but this type of column won't work properly in your case, since it doesn't inherit from GridViewBoundColumnBase.

    Greetings,
    Ivan Ivanov
    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

  6. Jason
    Jason avatar
    25 posts
    Member since:
    Aug 2012

    Posted 21 Jun 2011 Link to this post

    Hey Ivan,

    I was hoping that you could extend your example project to show me how this could be done.  I tried various techniques and was unable to get the behaviour that I was looking for.

    Thanks,

    Jason

  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    971 posts
    Member since:
    Dec 2014

    Posted 21 Jun 2011 Link to this post

    Hi Jason,

    I have added this feature to my project. Please, refer to it.

    Kind regards,
    Ivan Ivanov
    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

  8. Rob Ainscough
    Rob Ainscough avatar
    147 posts
    Member since:
    Jan 2010

    Posted 06 Dec 2012 Link to this post

    I have the exact same need but using an Silverlight 5 project ... any chance you have a working code sample for SL5?

    It does seem to me odd that the GridViewToggleRowDetailsColumn has an "IsVisible" property that apparently can't be bound like other columns ... it's a pretty common UI request to NOT show a details button when there are no details present.

    I've posted in the SL forum asking about this, any help would be appreciated and it would be even better if support for IsVisible data binding were included in the SL RadControls.

    Thanks, Rob.

Back to Top
Download a free trial of UI for WPF