Carlos Blanco
Carlos Blanco

Reputation: 8762

RadGridView hide children indicator

Is there a way to hide the children-plus-sign indicator. I want to hide it when some condition applies.

enter image description here

Upvotes: 0

Views: 1470

Answers (1)

mabian69
mabian69

Reputation: 716

I just faced a very similar problem and solved it:

Add this section to your top level (parent) grid view:

                <telerik:RadGridView.Columns>
.
... your top level columns here
.
                </telerik:RadGridView.Columns>

                <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition />
                </telerik:RadGridView.ChildTableDefinitions>

                <telerik:RadGridView.RowStyleSelector>
                    <telerik:ConditionalStyleSelector>
                        <telerik:StyleRule Condition="expandable">
                            <Style TargetType="telerik:GridViewRow">
                                <Setter Property="IsExpandable" Value="True" />
                            </Style>
                        </telerik:StyleRule>
                        <telerik:StyleRule Condition="Not expandable">
                            <Style TargetType="telerik:GridViewRow">
                                <Setter Property="IsExpandable" Value="False" />
                            </Style>
                        </telerik:StyleRule>
                    </telerik:ConditionalStyleSelector>
                </telerik:RadGridView.RowStyleSelector>

Then declare in your row ViewModel the "expandable" property which should eveluate to true if the row has to show the plus/minus image.

Here is mine:

    public bool expandable
    {
        get { return (this.row.Count() > 0); }
    }

It works perfect here!

Hope it helps, Mario

Upvotes: 7

Related Questions