Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DataGrid Selection Color Disappearing #1728

Closed
Camuvingian opened this issue Jan 3, 2015 · 0 comments
Closed

DataGrid Selection Color Disappearing #1728

Camuvingian opened this issue Jan 3, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@Camuvingian
Copy link

I have a control which is essentially a DataGrid. These get housed on separate tabs in a TabControl via AvalonDock. The selection color is set correctly when each tab is loaded pre-MahApps V1.0.0.0, however having now updated to V1.0.0.0, when I switch tabs and then back to the previous one, the selected highlight color disappears, like the fore-color and background-color have both been set to transparent/white. See

datagridselectionerror

You can see when I select a different tab and return the selection color is changed and then when I scroll out and back into view the selection coloring returns. This seems like a virtualisation issue, but it is a problem that I can fix by setting options on my DataGrid. For reference, the XAML for this control is

<DataGrid x:Name="CoreGrid"
             Panel.ZIndex="0"
             HorizontalAlignment="Stretch"
             VerticalAlignment="Stretch"
             AutoGenerateColumns="True" 
             CanUserAddRows="False" 
             CanUserDeleteRows="True"
             SelectionUnit="Cell"
             EnableRowVirtualization="True" 
             EnableColumnVirtualization="True" 
             VirtualizingStackPanel.VirtualizationMode="Recycling" 
             SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
             GridLinesVisibility="{Binding GridLinesVisibility}"
             Caliburn:Message.Attach="
                [Event CellEditEnding] = [Action CellEditEnding($this, $eventArgs)]; 
                [Event SelectedCellsChanged] = [Action SelectedCellsChanged($this, $eventArgs)]">
    <Interactivity:Interaction.Behaviors>
        <Behaviors:BindableSelectedItemsBehavior
            SelectedItems="{Binding SelectedItems, Mode=TwoWay}"/>
    </Interactivity:Interaction.Behaviors>  
    ...
</DataGrid>

I can confirm that this problem does not occur when I use the previous version of MahApps. How can I prevent the selection/highlight color disappearing?

Thanks for your time.

@punker76 punker76 added this to the 1.1.0 milestone Feb 24, 2015
@punker76 punker76 self-assigned this Feb 24, 2015
@punker76 punker76 added the Bug label Feb 24, 2015
punker76 added a commit that referenced this issue Feb 24, 2015
…isappearing-fix

Fix DataGrid Selection Color Disappearing #1728
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

No branches or pull requests

2 participants