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.
Hello Pragati,
I can suggest you use the XamGrid’s Indentation Property instead of setting the Padding of the ColumnLayout. I have already logged a Product Idea on your behalf about the Virtualization of the XamGrid, which will prevent the scrolling issues. Also the Column Headers are synchronized till the moment you scroll any of the nested grids.
Hope this helps you.
Hello Yanko,I've attached the sample application herewith. With reference to previous posts and sample, you will get idea that; I'm adding the row details dynamically with another Infragistics grid in datatemplate. I'm getting the headers and horizontal scrollbar for each child grid. 1) As the headers of outermost parent & the children of all the levels are same, can I use the outermost headres for all the grids in different level with the outermost scrollbar scrolling all the grids? Stefan had given the solution with opacity of scrollbar = 0, it hides the scrollbars. But, I need to scroll same column in all levels grids synchronously. As I'm having upto 20th - 25th level heirarchy, this may exceed upto 100 even, in such case its not good to see scrollbar for each grid.2) While scrolling vertically, the expanded rows get disturbed. Some get collapsed, some get hidden or unnecessary white space in child grid.3) After expand and collapse all the levels, and again expanding one by one, it shows the blank space of previous expanded levels. I cannot generate it in this sample, but Stefan said that it seems to be expected since the XamGrid has a built-in UI virtualization.4) The headers of child grid are not aligned properly. You can check this expanding the last row element in sample. 5) I need indentaion in Name column as per heirarchy. I already have some indentation for parent grid's column value for some specific rows. So, whatever are those, in child grid I need to add one more space for value in Name column. I've got the indentation for parent with setting the padding in parent grid's ColumnLayoutAssigned event, Depending upon parent row's padding to set the padding for child, I tried in RowExpansionChanging event of parent grid to get its padding with Thickness obj = e.Row.Cells["Name"].Control.Padding; But, its giving 0,0,0,0 though it is 10,0,0,0 in fact. Is the indentaion possible with Padding or any other way is there?
Thanks,Pragati.
Hello pragati,
Would you please attach the final version of your sample application in order to provide you with more accurate assistance ?
Looking forward to hearing from you.
Hello Stefan,In parent grid's ColumnLayoutAssigned event, I've set the padding for secific cells in column 2. I need to add the padding for child grid's cells in column 2 itself, depending upon parent row's padding. I tried in RowExpansionChanging event of parent grid to get the padding with Thickness obj = e.Row.Cells["Description"].Control.Padding; But, its giving 0,0,0,0 though it is 10,0,0,0 in fact.Actually, I need indentation with padding.Please, help.Thanks,Pragati.
Hello Stefan,Back to the scrollbar. In sample project, you have hidden(opacity=0) the scrollbars. But, with this, what I required is - while scrolling either parent grid or child grid, with parent scrollbar or with mouse wheel; all the grids should get scrolled synchronously. One more thing, can we get checked in event RowExpansionChanging, whether the row is getting collapsed or expanded?Please, help.Thank,Pragati.