Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
Specific row detail(ColumnLayout) expansion in code behind
posted

Hello,

My requirement is lazy binding of the column layout. On click of any cell of a row or on click of the expansion indicator of row, I want to load the data for columnlayout in code behind and keep that row in expanded state.
With the events - 

        void dataGrid_CellClicked(object sender, Infragistics.Silverlight.CellClickedEventArgs e)
        {
            IsCellClicked = true;
            ActiveRow = (Row)e.Cell.Row;
            lstCurrentData = (List<ChildNode>)dataGrid.ItemsSource;

            string strSelectedID = ((ChildNode)e.Cell.Row.Data).ID;
            List<ChildNode> lstChildren = new List<ChildNode>();
            lstChildren = GetTheDataByParentID(strSelectedID);
  
     /* To get the children assign to respective node */
            SearchRecursive(lstCurrentData, strSelectedID, lstChildren);

            dataGrid.ItemsSource = null;
            dataGrid.ItemsSource = lstCurrentData;
            dataGrid.UpdateLayout();
        }

and

         void dataGrid_RowExpansionChanged(object sender, Infragistics.Silverlight.RowExpansionChangedEventArgs e)
         {
             List<ChildNode> vm = dataGrid.DataContext as List<ChildNode>;
             lstCurrentData = (List<ChildNode>)dataGrid.ItemsSource;
 
             string strSelectedID = ((ChildNode)e.Row.Data).ID;
             List<ChildNode> lstChildren = new List<ChildNode>();
             lstChildren = GetTheDataByParentID(strSelectedID);
 
             SearchRecursive(lstCurrentData, strSelectedID, lstChildren);
 
             dataGrid.ItemsSource = null;
             dataGrid.ItemsSource = lstCurrentData;
            dataGrid.UpdateLayout();
         }

I get the data in ColumnLayout, but I need the respective row in expanded state. Now as the code in RowExpanded event is reassigning the ItemSource, its not allowing the row to expand on expander arrow click. But as I want to load the data for column layout at the time of expand, I've to do it in that event itself. Is there any other way for this? Please, help.

Thanks,
Pragati.

 

 

 

 

Parents Reply
  • 665
    posted in reply to Pragati

    Hello Stefan,
    I'm facing the issues while expanding the children rows & grids in that. As shown below,



    1) The headers of child grid are not alligned properly.
    2) After expand and collapse all the levels, and again expanding one by one, it shows the blank
    space of previous expanded levels.

    Thanks,
    Pragati.

     

Children