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

IsExpandable for GridViewToggleRowDetailsColumn

1 Answer 222 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Avi
Top achievements
Rank 1
Avi asked on 21 Dec 2011, 02:02 PM
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
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Rob Ainscough
Top achievements
Rank 1
answered on 29 Nov 2012, 10:21 PM
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
Tags
GridView
Asked by
Avi
Top achievements
Rank 1
Answers by
Rob Ainscough
Top achievements
Rank 1
Share this question
or