IsExpandable for GridViewToggleRowDetailsColumn

2 posts, 0 answers
  1. Avi
    Avi avatar
    25 posts
    Member since:
    Oct 2010

    Posted 21 Dec 2011 Link to this post

    Hello,

    I have a RadGridView and I don’t want to enable the Expand button (+) to expend (to be open) if the "IsDivided" property value =false. 
    I added a RowLoaded Event " RefundsGrid_RowLoaded" where I set the IsExpandable property of the row to false but it's not disabling the "+" to be expend (open) .

    I read this blog: http://blogs.telerik.com/xamlteam/posts/10-06-03/how---to-bind-to-isexpandable-property-of-gridviewrow-in-radgridview-for-wpf-with-attached-behaviors.aspx

    But I'm not sure if it's relevant in my case.

    On I put on "IsVisible" value false it work OK and don't show the (+). But when I Binding in to property IsDivided. it's not working
    <telerik:GridViewToggleRowDetailsColumn Width="10" IsResizable="False" IsVisible="{Binding IsDivided}" />

    public bool IsDivided
    {
        get
        {
            return (DivideCode.Equals('k'));
        }
    }

    and the second option I try is this.

    The code is as follows:
     What am I missing?  

    <UserControl.Resources>      
        <DataTemplate x:Key="RefundProvisionsGridCell">
            <uc:RefundProvisionsGrid/>
        </DataTemplate>     
     </UserControl.Resources>
      
    <telerik:RadGridView Name="RefundsGrid" RowLoaded="RefundsGrid_RowLoaded" ItemsSource="{Binding Refunds}" RowDetailsTemplate="{StaticResource RefundProvisionsGridCell}">
        <telerik:RadGridView.Columns>
            <telerik:GridViewToggleRowDetailsColumn Width="10" IsResizable="False" />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
    private void RefundsGrid_RowLoaded(object sender, RowLoadedEventArgs e)
    {
        if (e.DataElement != null)
        {
            GridViewRow row = e.Row as GridViewRow;
            Refund refund = (Refund)e.DataElement;
            if (row != null && refund != null)
            {
                row.IsExpandable = refund.IsDivided; //try this one with no help
                row.IsExpanded = refund.IsDivided;  //try this one with no help
                row.DetailsVisibility = refund.IsDivided ? Visibility.Visible : Visibility.Collapsed; //try this one with no help
            }
        }
    }
  2. Rob Ainscough
    Rob Ainscough avatar
    262 posts
    Member since:
    Jan 2010

    Posted 29 Nov 2012 Link to this post

    I know this is old, but is there no solution to this?

    I'm having a similar issue, I can't seem to bind GridViewToggleRowDetailsColumn IsVisible ... well I can bind it, but it doesn't seem to do anything ... no binding errors being generated and the binding value is set in my VM.

    I looked at the online sample and the code seems to be completely unrelated to the specific example??

    Rob
Back to Top