GridViewRow.IsExpandable not working for Child Level

2 posts, 0 answers
  1. Rocky Fernandes
    Rocky Fernandes avatar
    12 posts
    Member since:
    Jul 2009

    Posted 12 Feb 2010 Link to this post

    Query#1:
    I have a RadGridView(with name RadGridWorkPlan) with three levels. I do not want to display  Expand button (+) if the row do not have child items. I added a RowLoaded Event RadGridWorkPlan_RowLoaded. At first the RowLoaded even was firing for only the top level. I then after some self reserach added foolowing code on RadGridWorkPlan_DataLoading

    private void RadGridWorkPlan_DataLoading(object sender, GridViewDataLoadingEventArgs e)
    { 

        GridViewDataControl dataControl = (GridViewDataControl)sender;
        if(dataControl.ParentRow != null) 
        {
            dataControl.RowLoaded += new EventHandler<RowLoadedEventArgs>(RadGridWorkPlan_RowLoaded);
        }
    }

    Now RadGridWorkPlan_RowLoaded is getting fired for all Rows.
    Following is my RadGridWorkPlan_RowLoaded code

    private void RadGridWorkPlan_RowLoaded(object sender, RowLoadedEventArgs e)
     {
                GridViewRow row = e.Row as GridViewRow;
                if (row != null)
                {
                    var workPlanSummary = row.DataContext as WorkPlanSummary;
                    if (workPlanSummary != null)
                    {
                        int count = -1;
                        if(workPlanSummary.ChildItems !=null)
                            count = workPlanSummary.ChildItems.Count;

                        bool isExp = count > 0;
                        if (!isExp)
                        {
                            row.IsExpandable = isExp;
                            row.Background = new SolidColorBrush(Colors.Red);
                        }
                       
                    }
                    else
                    {
                        row.IsExpandable = false;
                    }
                }
     }

     

     

     

    For the Parent Level, the code works fine.
    For Lev 2 & 3 Rows,  If the Row doesn't have any child items, the Row color is displayed Red but the expandable (+) is still shown for those items. I did line debuging and the row.IsExpandable does get set true or false based on the items. But isExpandable function is not working.

    Can you give me suggestion or the fix.


    Query #2
    I also want to change the filter icon dynamically for certail columns. I saw a post for WPF. http://www.telerik.com/community/forums/wpf/gridview/changing-the-funnel-filter-icon.aspx
    I would need a similar solution for Silverlight. Can you provide sample code as well on this.

    Query #3.
    As said in My Query#1, I have Hirerachical RadGrid. I donot want to show data on top level columns accept the Title column. If I remove the Databinding for the first lelel columns, the filter icons disapears.How do I accomplish this - I need the filter icons at the same time the data in the first level columns shouldn't be displayed.
     

     

     

     

     

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 16 Feb 2010 Link to this post

    Hello Rocky Fernandes,

    Please see my reply in the support ticket you have opened.

    Best wishes,
    Ross
    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.
Back to Top