how collapse rowdetails raddataform

2 posts, 1 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 01 Dec 2016 Link to this post

    Basically, when the use hits the OK button in the raddataform for a particular row I want to collapse the details.

    An Mvvm friendly solution would be great!

    Thanks ... Ed

     

  2. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1173 posts

    Posted 05 Dec 2016 Link to this post

    Hello Ed,

    In order to achieve the desired behavior you can handle RadDataForm's EditEnded event, pass in the parent row as a command parameter and set its DetailsVisibility property to Collapsed. Here's what I have in mind:

    <telerik:RadDataForm>
        <telerik:EventToCommandBehavior.EventBindings>
            <telerik:EventBinding Command="{Binding EditEndedCommand, Source={StaticResource MyViewModel}}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewRow}}" EventName="EditEnded" />
        </telerik:EventToCommandBehavior.EventBindings>
    </telerik:RadDataForm>
    private void OnEditEndedCommandExecuted(object obj)
    {
        var row = obj as GridViewRow;
        row.DetailsVisibility = System.Windows.Visibility.Collapsed;
    }

    Please let me know whether such an approach would work for you.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top