Hi Stefan,
We are using XamGrid and have made a column IsGroupBy=True to apply grouping by default and it is working fine except one thing that we want to make all rows expanded. We are using MVVM so can you help us in this regard. I use the XamGrid's Laoded and my code is
public static void ExpandAllGroups(XamGrid grid) { if (grid != null) { foreach (Row item in grid.Rows) { if (item.RowType == RowType.GroupByRow) { item.IsExpanded = true; } } } }
This is working fine Expand all groups at first time, but when i select the specific item from grid and edit it through dialogue box, on closed the dialogue box i get again all the record from database when assign to xamgrid collection who already bind it, collection are updated and also grid groups are collapsed and my selected row was unselect.
AddEditIndicators view = new AddEditIndicators(); AddEditIndicatorsViewModel vm = new AddEditIndicatorsViewModel(_selectedIndicator); vm.RequestViewClose += (sndr, evt) => { view.Close(); }; view.DataContext = vm; view.Closed += (s, a) => { this.InterpolatedIndicators = InterpolatedIndicatorFieldInfo.GetAll(false, false); }; view.Owner = ((App)App.Current).AppMainWindow; view.ShowDialog();
private List<InterpolatedIndicatorFieldInfo> _lstIndicators; public List<InterpolatedIndicatorFieldInfo> InterpolatedIndicators { get { return _lstIndicators; } set { _lstIndicators = value; OnPropertyChanged("InterpolatedIndicators"); } }
InterpolatedIndicators collection is bind with grid. AddEditIndicators is a view used for edit the record.
Hello Abu,
Thank you for your post. I have been looking into it and I suggest you create a Style for the GroupByRowCellsPanel and add an EventSetter for the Loaded event like this:
<Style TargetType="{x:Type igPrim:GroupByRowCellsPanel}"> <EventSetter Event="Loaded" Handler="GroupByRowCellsPanel_Loaded"/> </Style>
And also add the following handler:
private void GroupByRowCellsPanel_Loaded(object sender, RoutedEventArgs e) { ((sender as GroupByRowCellsPanel).Row as Row).IsExpanded = true; }
Please let me now if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Now groups are not collapsed but my selected row was unselect, and my cursor goes to top if i edit the last record of grid. how to fix the pointer on the selected row after closed the dialogue box.