Team,
I have a silverlight grid and enabled the GroupBy feature. One of the column in the grid is a textbox field which allows user to modify the value. There is a save button from the page for user to save the changes.
However, when user does the column groupby, expand one of the grouped row, then make some changes to the value and click on the save button. After the button clicked, the expanded group row is now collapsed. Is there a way we can keep the expanded row expand after the button click event?
Thanks for any advice.
Chris
Hi Stefan,
I can provide you the code snippet. Sorry not able to provide you the sample project as it is quite big. Hope this help.
mycodepage.xaml
<ig:XamGrid x:Name="SearchResults" Grid.Row="2" AutoGenerateColumns="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding ResultSet}" RowHover="None" Foreground="Black" FontSize="8" TabNavigation="Once">
<ig:XamGrid.Resources>
</ig:XamGrid.Resources>
<ig:XamGrid.AddNewRowSettings>
<ig:AddNewRowSettings AllowAddNewRow="None" />
</ig:XamGrid.AddNewRowSettings>
<ig:XamGrid.ColumnChooserSettings>
<ig:ColumnChooserSettings AllowHiddenColumnIndicator="False" ColumnChooserDisplayText="Choose Columns..." AllowHideColumnIcon="True" HiddenColumnIndicatorToolTipText="Show Hidden Column(s)" />
</ig:XamGrid.ColumnChooserSettings>
<ig:XamGrid.ClipboardSettings>
<ig:ClipboardSettings AllowCopy="True" AllowPaste="False" CopyOptions="ExcludeHeaders" CopyType="SelectedCells" />
</ig:XamGrid.ClipboardSettings>
<ig:XamGrid.ColumnMovingSettings>
<ig:ColumnMovingSettings AllowColumnMoving="Indicator" />
</ig:XamGrid.ColumnMovingSettings>
<ig:XamGrid.ColumnResizingSettings>
<ig:ColumnResizingSettings AllowColumnResizing="Indicator" />
</ig:XamGrid.ColumnResizingSettings>
<ig:XamGrid.FilteringSettings>
<ig:FilteringSettings AllowFiltering="FilterRowTop" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True" />
</ig:XamGrid.FilteringSettings>
<ig:XamGrid.GroupBySettings>
<ig:GroupBySettings AllowGroupByArea="Top" IsGroupByAreaExpanded="True" />
</ig:XamGrid.GroupBySettings>
<ig:XamGrid.SortingSettings>
<ig:SortingSettings AllowMultipleColumnSorting="True" AllowSorting="True" FirstSortDirection="Ascending" MultiSortingKey="Control" ShowSortIndicator="True" />
</ig:XamGrid.SortingSettings>
<ig:XamGrid.SelectionSettings>
<ig:SelectionSettings CellClickAction="SelectRow" CellSelection="None" ColumnSelection="None" RowSelection="Single" />
</ig:XamGrid.SelectionSettings>
<ig:XamGrid.SummaryRowSettings>
<ig:SummaryRowSettings AllowSummaryRow="Bottom" SummaryExecution="PriorToFilteringAndPaging" SummaryScope="ColumnLayout" />
</ig:XamGrid.SummaryRowSettings>
<ig:XamGrid.EditingSettings>
<ig:EditingSettings AllowEditing="Row" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="DoubleClick" IsOnCellActiveEditingEnabled="True" />
</ig:XamGrid.EditingSettings>
<ig:XamGrid.Columns>
<ig:TemplateColumn Key="TradeDate" HeaderText="Trade Date" IsSummable="False" MinimumWidth="80" IsHideable="False">
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TradeDate, StringFormat=MM/dd/yyyy}" />
</DataTemplate>
</ig:TemplateColumn.ItemTemplate>
<ig:TemplateColumn.FilterItemTemplate>
<TextBlock Text="{Binding Value}" ToolTipService.Placement="Mouse" ToolTipService.ToolTip="{Binding Value}" />
</ig:TemplateColumn.FilterItemTemplate>
<ig:TemplateColumn.FilterEditorTemplate>
<TextBox Text="{Binding Value, Mode=TwoWay}" Utilities:TextBoxRealtimeBindingUpdater.UpdateSourceOnChange="True" />
</ig:TemplateColumn.FilterEditorTemplate>
<ig:TemplateColumn.FilterColumnSettings>
<ig:FilterColumnSettings>
<ig:FilterColumnSettings.RowFilterOperands>
<ig:EqualsOperand />
<ig:GreaterThanOperand />
<ig:GreaterThanOrEqualOperand />
<ig:LessThanOperand />
<ig:LessThanOrEqualOperand />
<ig:NotEqualsOperand />
</ig:FilterColumnSettings.RowFilterOperands>
<ig:FilterColumnSettings.FilteringOperand>
</ig:FilterColumnSettings.FilteringOperand>
</ig:FilterColumnSettings>
</ig:TemplateColumn.FilterColumnSettings>
<ig:TemplateColumn.GroupByItemTemplate>
<TextBlock Text="{Binding Value, StringFormat=MM/dd/yyyy}" />
</ig:TemplateColumn.GroupByItemTemplate>
</ig:TemplateColumn>
<ig:TemplateColumn Key="FourCharCode" HeaderText="Trading Area" IsSummable="False" MinimumWidth="80" IsHideable="False" IsSortable="True">
<TextBlock Text="{Binding FourCharCode}" />
<ig:FilterColumnSettings >
<ig:ContainsOperand />
<ig:DoesNotContainOperand />
<ig:StartsWithOperand />
<ig:DoesNotStartWithOperand />
<ig:EndsWithOperand />
<ig:DoesNotEndWithOperand />
<ig:TemplateColumn Key="Quantity" HeaderText="Quantity" IsSummable="False" MinimumWidth="80" IsGroupable="False" IsHideable="False" IsSortable="True" HorizontalContentAlignment="Right">
<TextBlock Text="{Binding Quantity, Converter={StaticResource DoubleFormatConverter}}" />
<ig:TemplateColumn Key="IdeaTime" HeaderText="Target Time" IsSummable="False" MinimumWidth="80" MaximumWidth="320" Width="Auto" IsSortable="False" IsGroupable="False" IsHideable="False">
<StackPanel x:Name="IdeaTimeInput" Orientation="Horizontal" Margin="3,5,3,5" DataContext="{Binding}" >
<ig:XamNumericEditor x:Name="IdeaHour" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding IdeaHour, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="IdeaHour" />
<ig:XamNumericEditor x:Name="IdeaMinute" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding IdeaMinute, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="IdeaMinute" />
<ig:XamNumericEditor x:Name="IdeaSecond" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding IdeaSecond, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="IdeaSecond" />
</StackPanel>
</ig:XamGrid.Columns>
</ig:XamGrid>
<Grid Grid.Row="1" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="SaveChanges" Grid.Column="0" HorizontalAlignment="Right" Style="{StaticResource GreenButton}" Content="Save" MinWidth="120" Click="SaveChanges_Click" />
</Grid>
mycodepage.xaml.cs
private void SaveChanges_Click(object sender, RoutedEventArgs e)
{
// Given grid rows are "Group By" on FourCharCode column and one of the grouped row is expanded
// performing the update from getting the value in the IdeaHour, IdeaMinute, and IdeaSecond and save to the database
// some update code goes here
// rebind the record to the XamGrid
// rebind code goes here
// After the rebind, the expanded row is now collapsed.
// How do we make the expanded row to be kept expanded after the update????
}
Hello Chris,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post, but I cannot be completely sure how you save your data and what does the Button you have for saving Row’s Data, so could you please send me an isolated sample project, where this is reproduced, so I can investigate it further for you.
Feel free to write me if you have further questions.
Is there any help can be provided by Infragistic team? Haven't had any response from anyone from the team. Please help.
Infragistics team,
Any help please?