I have an issue with XamDataGrid with persisting selected row/cell color even when they are unselected.
Hello Lanre,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hello,
I have been looking into the XAML code you have provided, but since you execute some custom code in the events you handle I am not able to reproduce your behavior, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
<igDP:XamDataGrid DataSource="{Binding Path=GridMapping}" Name="InputMappingXamDataGrid" GroupByAreaLocation="None" Theme="IGTheme" InitializeRecord="InputMappingXamDataGrid_InitializeRecord" CellActivated="InputMappingXamDataGrid_CellActivated" Sorting="InputMappingXamDataGrid_Sorting" EditModeEnded="InputMappingXamDataGrid_EditModeEnded" FieldLayoutInitialized="InputMappingXamDataGrid_FieldLayoutInitialized" Height="480" AutoFit="True"> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="HeaderAreaBackground" Value="LightBlue" /> </Style> <Style x:Key="PurpleMenuItemStyle" TargetType="ig:XamMenuItem"> <Setter Property="Background" Value="Transparent"/> <Setter Property="IsTabStop" Value="True"/> <Setter Property="IsEnabled" Value="True"/> <Setter Property="StaysOpenOnClick" Value="True" /> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <StackPanel Orientation="Vertical"/> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ig:XamMenuItem"> <Grid Background="Gray"> <Grid Margin="5,25,5,5" Background="White"> <!-- MenuItemPresenter - presentes the content of the menu item. --> <ContentControl x:Name="MenuItemPresenter" HorizontalContentAlignment="Stretch" Visibility="Visible" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" Foreground="{TemplateBinding Foreground}" Opacity="1" Margin="5"> <Grid > <Grid.ColumnDefinitions> <ColumnDefinition x:Name="LabelColumn" Width="Auto" /> <ColumnDefinition x:Name="DropdownColumn" Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <!-- Label presenter--> <TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Text="Stream" /> <TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Text="Record" /> <TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" Text="Item" /> <!-- DropDown presenter--> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="0" Name="StremContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding StreamsList}" DisplayMemberPath="ItemName" /> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="1" Name="RecordContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding RecordList}" DisplayMemberPath="ItemName" /> <igEditors:XamComboEditor Grid.Column="1" Grid.Row="2" Name="ItemContextDP" Height="Auto" MinWidth="150" Style="{StaticResource ComancheXamComboEditorCtrl}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ItemsSource="{Binding ItemList}" DisplayMemberPath="ItemName" /> <Button Content="Set All" Grid.ColumnSpan="2" Grid.Row="3" HorizontalAlignment="Right" Margin="2"/> </Grid> </ContentControl> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type igDP:LabelPresenter}"> <EventSetter Event="PreviewMouseRightButtonDown" Handler="lp_PreviewMouseRightButtonDown"/> </Style> <DataTemplate x:Key="MenuDataTemplate"> <StackPanel Orientation="Horizontal"> <Border Padding="3"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding }" /> </StackPanel> </Border> </StackPanel> </DataTemplate> </igDP:XamDataGrid.Resources> <igCtxMenu:ContextMenuService.Manager> <igCtxMenu:ContextMenuManager> <igCtxMenu:ContextMenuManager.ContextMenu> <igCtxMenu:XamContextMenu ItemClicked="XamContextMenu_ItemClicked" Opening="XamContextMenu_Opening" ItemTemplate="{StaticResource MenuDataTemplate}" Closing="XamContextMenu_Closing" Loaded="XamContextMenu_Loaded" > </igCtxMenu:XamContextMenu> </igCtxMenu:ContextMenuManager.ContextMenu> </igCtxMenu:ContextMenuManager> </igCtxMenu:ContextMenuService.Manager> <igDP:XamDataGrid.FieldLayouts> <!-- define a field layout that will match the data --> <igDP:FieldLayout> <igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings SelectionTypeRecord="Extended" HighlightPrimaryField="SameAsOtherFields" /> <!--<igDP:FieldLayoutSettings SelectionTypeCell="None" SelectionTypeField="None" />--> </igDP:FieldLayout.Settings> <!-- define the fields for the field layout --> <igDP:FieldLayout.Fields> <!--#END SNIPPET#--> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
I should actually have put the code in my previous post. There a bunch of event handlers that make calls to set the grids itemsource in the view model. I have tried to clear the selected row colors but to no avail. Is there away to clear those selected color that persist without refreshing the grid.
Thanks.
Thank you for your post. I have been looking into it, but since I cannot be completely sure how your data is organized and how do you persist the XamDataGrid, I am not able to reproduce your behavior, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
This is another image of when everything was selected but there is no way to unselect